File Upload Problems with binary files (ASCII works ok) 
Author Message
 File Upload Problems with binary files (ASCII works ok)

Hello,

I was originally testing this on Unix/Apache with .txt files and they worked
fine but I need it primarily for .pdf files and
$_FILES['temp_filename']['tmp_name'] appears to be undef when I upload the
pdfs.  Code in question is below.  Commented out code was an attempt to use
copy() instead of   move_uploaded_file() but had same results.

Any ideas why a binary file or a pdf specifically would cause a problem?

TIA,
jg

$path = realpath(".") . "/";
$destination_filename = $dir_name . ".pdf";
$newdir = "$path$dir_name";
mkdir("$newdir");
chmod("$newdir", 0777);

$upped_file = $_FILES['temp_filename']['tmp_name'];

//if (!copy($upped_file, "$newdir/$destination_filename")) {
//print ("failed to copy $upped_file...<br>\n");
//}

move_uploaded_file($upped_file, "$newdir/$destination_filename")
  or die ("Can't copy file to $newdir/$destination_filename");



Mon, 20 Jun 2005 06:54:01 GMT  
 File Upload Problems with binary files (ASCII works ok)
Addtional tests show that I can run a gif or jpeg through this and succeed
(even displays correctly in browser dispite .pdf extension) but given even a
small (9 Kb) pdf the move_uploaded_file can seem to find the uploaded file,
same results for .doc files.

Any help?

jg



Mon, 20 Jun 2005 07:09:57 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Problem while uploading a binary file using cgi module

2. Special Problem and Solution regarding: CGI Binary File Uploading on Windows

3. Problems with uploading binary files using cgi module

4. Need converter program to translate ascii to ebcdic in mixes ascii/binary file

5. Reading a binary file / writing binary data to a file

6. CGI POST binary file upload?

7. Uploading binary files

8. uploading a binary file with ftplib

9. Upload of binary files

10. uploading binary files via cgi

11. uploading binary file - ODBC (SapDB)

12. Binary search for fixed length ascii files.

 

 
Powered by phpBB® Forum Software