Upload script not working

Using the upload example from @Gilmichel

Every upload results in image which is one byte (corrupted). Not getting any error, just corrupt image in uploads folder.

For fun, tried a .txt file and also corrupted as all contents of text file replaced with a single “1”.

Any ideas how to solve this issue?

There is a working upload sample in the demo that ships with ExeOutput. Take a look at it, it’s working fine (uploaded file is not corrupted).

Yes, have been using it. Matter of fact had to make some changes to get it working with php7.2:

$array = explode('.',$_FILES['image']['name']);
$file_ext=strtolower(end( $array));

Throwing errors when changing from php5.6.

But, I like to try the one above so will see if can figure it out.

Thanks.

Replace :
$file = file_put_contents($target_file, FILE_USE_INCLUDE_PATH);
With:
move_uploaded_file($_FILES[“fileToUpload”][“tmp_name”], $target_file);

Perfect, thank you!

1 Like