rklockner Posted January 11, 2011 Share Posted January 11, 2011 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). Quote Link to comment https://forums.phpfreaks.com/topic/224116-files-becoming-corrupt/ Share on other sites More sharing options...
gibigbig Posted January 11, 2011 Share Posted January 11, 2011 Post the code please. Quote Link to comment https://forums.phpfreaks.com/topic/224116-files-becoming-corrupt/#findComment-1158050 Share on other sites More sharing options...
PFMaBiSmAd Posted January 11, 2011 Share Posted January 11, 2011 Without any information about how you are uploading, storing, and serving/downloading the files, it is a little hard to help. Quote Link to comment https://forums.phpfreaks.com/topic/224116-files-becoming-corrupt/#findComment-1158061 Share on other sites More sharing options...
rklockner Posted January 11, 2011 Author Share Posted January 11, 2011 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). Quote Link to comment https://forums.phpfreaks.com/topic/224116-files-becoming-corrupt/#findComment-1158082 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.