Forums: Watch out for this pitfall with upload files - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Watch out for this pitfall with upload files

#1 User is offline   Pete K 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 187
  • Joined: 05-February 16

Posted 07 November 2017 - 04:15 PM

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.


----------------------------------------------------------
Pete K.
Web Developer
Fayette County Public Schools | Lexington, Kentucky, USA
0

#2 User is offline   jadach 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 338
  • Joined: 26-April 08

Posted 16 November 2017 - 01:01 AM

View PostPete K, on 07 November 2017 - 11:15 AM, said:

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 :)
I prefer uploading files to the database, so it isn't often I have to care too much.
-jerry
0

#3 User is offline   Pete K 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 187
  • Joined: 05-February 16

Posted 17 November 2017 - 12:01 PM

View Postjadach, on 15 November 2017 - 08:01 PM, said:

Been there done that. Same concern with signature pad plugin. BE CAREFUL :)
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.


----------------------------------------------------------
Pete K.
Web Developer
Fayette County Public Schools | Lexington, Kentucky, USA
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic