I think this may be a dumb question, but what exactly is the code that actually uploads the file? I see over & over again copy(). Is that the peice that does it or am I missing some function somewhere?
I have an excel file that when it runs says it does not upload. If I look at the ws_ftp screen I see it newly there on the server side. If I view it from ws_ftp, it will display what is in the file, although not in an excel sheet. If I then try to download it from a form, it downloads, but the saved or opened sheet is blank! What am I doing wrong?
This is the upload form:
<form method=post action="load.php" enctype="multipart/form-data">
enter file to upload<input type="file" name="uploadFile"><br><br>
<input type="submit" value="save">
<input type="reset" value="clear save box">
</form>
This is the upload (or what's left after playing with it so long):
<?php
$upfile_name = $_FILES['uploadFile']['name'];
$dir = "../webpage/Report";
//copy($_FILES['uploadFile']['tmp_name'], "$dir/$upfile_name");
if(!$userfile_size)
echo "\nThis file: $uploadFile, did not upload";
else{
copy($_FILES['uploadFile']['tmp_name'], "$dir/$upfile_name");
}
?>
This is the download:
<?php
//updated 1/18
//Content-type was also application/octet-stream or something like that before
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename=$file_name");
header("Content-Description: PHP DOWNLOAD");
header("Content-Length: $file_size");
readfile($file_name);
?>
Thanks for any help.