Jump to content

Files Becoming Corrupt


rklockner

Recommended Posts

I have a section where users can upload documents into our software.  The code itself is a couple years old and could perhaps use some updating, but it seems some of the files (at this time it only seems to be *.pdf) that have been uploaded are not able to be opened and the error "the file is damaged and could not be repaired" is being displayed as an "Adobe Reader" error in Internet Explorer 8.

 

The largest concern is that it is an irreversible error and many of the documents users have uploaded are now corrupt.  I can't seem to find any relevant information from Google (or Adobe) that does anything towards resolving the problem.

 

Note: This does not happen on every .pdf, and I am not sure if there is a common bond between the failing documents (trying to find this now).

Link to comment
Share on other sites

It appears that the user is closing the page early before the entire document is uploaded (but I'm still researching).

 

The upload code is:

$uploaddir = "docs/";

$f = $_FILES["doc"];
$file_id = uniqid();

$n = $uploaddir . $file_id . "." . get_ext($f["name"]);

copy($f["tmp_name"], $n);

 

FYI: get_ext() is a function to get the files extension (I'm sure you could have figured that out).

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.