php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19205 File upload results in an empty file
Submitted: 2002-08-30 18:35 UTC Modified: 2002-09-03 18:18 UTC
From: dreamcaster at microdreams dot com Assigned:
Status: Not a bug Package: Output Control
PHP Version: 4CVS-2002-08-30 OS: Unix
Private report: No CVE-ID: None
 [2002-08-30 18:35 UTC] dreamcaster at microdreams dot com
When I use php to perform a file upload, it results in an empty file being placed on the server. The file name is right, the file extension is right, but the file is simply empty. Calling up the image in a browser yields a broken image. My server is running php 4.0.4pl1 and for certain reasons out of my control, I cannot upgrade it. Is this a known problem for this build? Please let me know. If this is the case, then I will be able to convince the admins that they need to upgrade to a later build. Code:

function do_upload($filename,$newname) {
  $file = basename($filename);
  $tmp_upload_path = "/tmp/";
  $new_file_name = "/aa/cvsro/tltc/funding/proposals/" . $newname;
  if (!copy($tmp_upload_path.$file, $new_file_name)) echo "failed to copy file<br>\n";
  return;
}

Thanks!

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-03 18:18 UTC] sniper@php.net
Thank you for taking the time to report a problem with PHP.
Unfortunately you are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from http://www.php.net/downloads.php

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

First of all, 4.0.4pl1 is really too old..and has some security exploits too. And it's upload code really is buggy,
so you should get it updated.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 16:01:31 2024 UTC