Upload script not working

oldteacher

Active member
Using the upload example from @Gilmichel
5_f40856482fe1e45ac8f1605885140a2d.png
Sample Choosing and uploading a file with html form! How to (ExeOutput)
To choose and upload a file without using HEScript code you can do as follow: > <head> > <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.3.min.js"></script> > <style> > input[type="file"]{ > color: transparent; > } > </style> > </head> > <html> > <body> > <script> > $(function () { > $('input[type="file"]').change(function () { > if ($(this).val() != "") { > $(this).css('color', '#333'); > }else{ > $(this).css(…
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).
 
gdgsupport said:
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:
Code:
$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.
 
oldteacher said:
Every upload results in image which is one byte (corrupted). Not getting any error, just corrupt image in uploads folder.
Replace :
$file = file_put_contents($target_file, FILE_USE_INCLUDE_PATH);
With:
move_uploaded_file($_FILES[“fileToUpload”][“tmp_name”], $target_file);
 
Last edited:
Back
Top