This topic is locked

Watch out for this pitfall with upload files

11/7/2017 11:15:59 AM
ASPRunner.NET Tips and tricks
Pete K author

So I had this issue with uploaded files apparently becoming corrupt over time -- whether PDF or MS Office, users reported getting corrupted downloads. I couldn't figure it out. Then I thought to check and see if the file referenced in the database actually existed in the /files directory -- lo and behold, they did not!
What happened? Well, when I update an existing app, I create a new folder for it on the server and deploy to the new folder, then point IIS at the new folder. So, you can guess what happened... the older files were still in the old app folder. Fortunately for me, I don't delete those old folders right away -- more than once I've had to revert back to an older version while debugging some new prematurely-released code. So I was able to copy the old files to the new folder and all is well.
But now I'm going to start a new practice of having a common upload location that is absolute and won't change when the app folder changes. Te other option is to try to remember to merge the file folder with each new deployment -- something I don't trust myself to do.

jadachDevClub member 11/15/2017



So I had this issue with uploaded files apparently becoming corrupt over time -- whether PDF or MS Office, users reported getting corrupted downloads. I couldn't figure it out. Then I thought to check and see if the file referenced in the database actually existed in the /files directory -- lo and behold, they did not!
What happened? Well, when I update an existing app, I create a new folder for it on the server and deploy to the new folder, then point IIS at the new folder. So, you can guess what happened... the older files were still in the old app folder. Fortunately for me, I don't delete those old folders right away -- more than once I've had to revert back to an older version while debugging some new prematurely-released code. So I was able to copy the old files to the new folder and all is well.
But now I'm going to start a new practice of having a common upload location that is absolute and won't change when the app folder changes. Te other option is to try to remember to merge the file folder with each new deployment -- something I don't trust myself to do.


Been there done that. Same concern with signature pad plugin. BE CAREFUL <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=83728&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

I prefer uploading files to the database, so it isn't often I have to care too much.

Pete K author 11/17/2017



Been there done that. Same concern with signature pad plugin. BE CAREFUL <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=83741&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

I prefer uploading files to the database, so it isn't often I have to care too much.



I have done that as well. The issue is it gets more complicated when you want to allow multiple file uploads.