GoDaddy messed me up with ASPUpload!

I had a backend admin interface working perfectly using ASPUpload using the "Upload.Save" and File.SaveAs "d:\hosting\expatshow\uploads\gallery\" & NewName & File.ext until a few weeks ago.  Then GoDaddy changed something on their server that no longer allows Upload.Save method.  This generated the error below:

Persits.Upload.1 error '800a0028'
This feature has been disabled by system administrator. Use File.SaveVirtual instead.

I've been trying to do this, to no avail.  Here's my current code (forgive the commented out lines - I've tried hundreds of variations):
<%
Set Upload = Server.CreateObject("Persits.Upload.1")
Set UploadProgress = Server.CreateObject("Persits.Upload")
Upload.ProgressID = Request.QueryString("PID")
' Limit file size to 50000 bytes, throw an exception if file is larger
Upload.SetMaxSize 20971520, True

' Intercept all exceptions to display user-friendly error
On Error Resume Next

' Will not overwrite files
Upload.OverwriteFiles = False

' Perform upload
Upload.Save
'Upload.SaveVirtual "../uploads/gallery/"

' Use session ID as the new file name
'NewName = Session.SessionID

For Each File in Upload.Files
      File.SaveAsVirtual "../uploads/gallery/" & File.FileName
Next
%>

The Progress Bar indicates that it uploads the file to the memory.  It just won't write the file to my directory in wwwroot/uploads/gallery.  Any help would be greatly appreciated.  I believe permissions are correct, as it typically generates an error about not having permission to that directory.
elevatedmarketingAsked:
Who is Participating?
 
hc0904pcdCommented:
Here's a simple test - forget the looping code for now, that will be easy to sort out once the files loading is working.

On page 1, call it test.asp, put this,
<form action='test2.asp' enctype="multipart/form-data" method='post'>
      <input name='img1' type='file' />
      <input name='Submit' type='submit' value='Start Loading' />
</form>

And in page 2, called test2.asp, put this

Set Upload = Server.CreateObject("Persits.Upload")
Upload.OverwriteFiles = False
Upload.SetMaxSize 3000000, True      
Upload.SaveVirtual "/uploads/gallery/"

This works on my server in an environment where I know I have aspUpload, and file permissions set.

0
 
hc0904pcdCommented:
Hi,
Could you try using server.mappath to determiner where to save the upload?
0
 
elevatedmarketingAuthor Commented:
I think I've tried that in several different ways.  Since it's not actually writing the file to any of the directories (just to the server memory apparently), how would you do this?
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

 
hc0904pcdCommented:
Here's a sample,

Upload.SaveVirtual "/uploads/gallery/xxx.jpg"
or
Upload.SaveVirtual Server.MapPath(".") & "\uploads\gallery\xxx.jpg"

Hope this is useful?
From memory I think I started using Server.MapPath for the same reason as you - the host company blocks Save for security reasons.
SaveVirtual is good, just fiddly to get sorted out the first time!
0
 
hc0904pcdCommented:
One other thing to try - I have this in my sample code,

Set Upload = Server.CreateObject("Persits.Upload")
'Set Upload = Server.CreateObject("Persits.Upload.1")

I can't tell you why I commented out the second line as it was about two years ago, but I would have done it for a reason and the code works...
0
 
hc0904pcdCommented:
I've just tested this code as is, on my server,

<%
      Set Upload = Server.CreateObject("Persits.Upload")
      'Set Upload = Server.CreateObject("Persits.Upload.1")
      Upload.OverwriteFiles = False
      Upload.SetMaxSize 3000000, True      

      Upload.SaveVirtual "/uploads/gallery/"
      img1 = Upload.Form("img1")
      imgFilename = Upload.Form("imgFilename")
      Set File = Upload.Files("img1")
      'Response.Write File.FileName
      thisFile = File.FileName

      if Err <> 0 then
            Response.Write "An error occurred:" & Err.Description
      else
            On Error Goto 0
            Set File = Upload.Files(1)
            if File.ImageType = "UNKNOWN" then
                  File.Delete
                  response.write "Error, that file is not a recognised image format.>"
            end if
      end if
%>
0
 
elevatedmarketingAuthor Commented:
I've got so many variations now I'm confused.  This is what I currently have.  I've tried both of the above options you suggested (not yet tried your lengthy code) and still nothing.  I'm posting it below for you to take a look:

<%
Set Upload = Server.CreateObject("Persits.Upload")
Set UploadProgress = Server.CreateObject("Persits.Upload")
Upload.ProgressID = Request.QueryString("PID")
' Limit file size to 50000 bytes, throw an exception if file is larger
Upload.SetMaxSize 20971520, True

' Intercept all exceptions to display user-friendly error
On Error Resume Next

' Will not overwrite files
Upload.OverwriteFiles = False

' Perform upload
Upload.Save
'Upload.SaveVirtual Server.MapPath(".") & "..\uploads\gallery"
'Upload.SaveVirtual "../uploads/gallery/xxx.jpg"
'Upload.SaveVirtual "../uploads/gallery/"

' Use session ID as the new file name
'NewName = Session.SessionID

For Each File in Upload.Files
      File.SaveAsVirtual Server.MapPath(".") & "..\uploads\gallery\" & File.FileName
Next  
%>

The reason I have to use the last section File.SaveAsVirtual is because I actually have 12 images I'm uploading at a time.  It worked beautifully before GoDaddy blocked the Save function.
0
 
hc0904pcdCommented:
Hi elevatedmarketing,
Not to worry, I think you're nearly there.

The virtual save method is relative, which I forgot to mention in the sample I gave you
So your code
File.SaveAsVirtual Server.MapPath(".") & "..\uploads\gallery\" & File.FileName
will assume that uploads/gallery/ is relative to where the script file is.

Does that make sense?


0
 
elevatedmarketingAuthor Commented:
not really...  I'll try to map where I want the files to upload.

                      wwwroot
                            |
                            |
            Admin---------------Uploads
                |                            |
     AspUpload_script          Gallery (directory where I want the files to upload to)

Does this make sense at all?  Forgive the crude drawing.  So I want the files to use the AspUpload_script to go up one directory, over one directory and then down one directory into the "Gallery" folder.
0
 
hc0904pcdCommented:
Hi again,
Another approach to this would be to use

File.SaveAsVirtual Server.MapPath(Application("vroot") & "/uploads/gallery/")

I have used this with saUpload, which is similar to aspUpload.
It's a little bit easier to use because you can specify an address relative to the root rather than to the script.


0
 
elevatedmarketingAuthor Commented:
Unfortunately, that didn't work either.  It just won't save the file into the "Gallery" directory.  I'm completely stumped.
0
 
hc0904pcdCommented:
lovely sketch :)

Could you try this and let me know if it works ?

Upload.SaveVirtual "/uploads/gallery/"
0
 
hc0904pcdCommented:

Silly question I know, but your permissions are definitely set properly for /uploads/gallery/ ?
0
 
elevatedmarketingAuthor Commented:
I'm checking the permissions again.  They were set correctly earlier.
0
 
elevatedmarketingAuthor Commented:
THAT WORKED!!!!  Unbelievable!
0
 
hc0904pcdCommented:
Awesome!
I know how you feel because I've been there....
And I reckon the best answer is to strip things back to the absolute simplest of tests, het it working, and then put back the more complex stuff.
good luck with it.
0
 
elevatedmarketingAuthor Commented:
Thanks so much.  I'm not sure what you did, but it worked!
0
 
Rajesh DalmiaCommented:
I also faced similar problem last week. Then I modified the code as below and now it's working fine

ImageFolderVirtual = "/ApartImages/"
Set Upload = Server.CreateObject("Persits.Upload")
Upload.Save
For Each File in Upload.Files
   File.SaveAsVirtual ImageFolderVirtual & File.FileName
Next


U have to modify the code as per your requirement. Hope this will help u.

For you the ImageFolderVirtual Will be I think "/uploads/gallery/". and make sure that you have Read and Write permission in this online folder.


rdonline1
0
 
elevatedmarketingAuthor Commented:
I ended up using a variation of both of your codes.  Thanks so much!
0
 
Rajesh DalmiaCommented:
Glad I could help.


rdonline1.
0
 
hc0904pcdCommented:
same here :)
0
 
Minion1Commented:
HI all,

I recently set up an uploading system for a .csv file on GoDaddy's servers and had this exact same probalem about 2 weeks after the script was running perfectly fine. I think GoDaddy somehow monitors for the Save As function, and then shuts down your application without informing the customer. This problem just seemed wierd.

Anyway, I just wanted to say that I used the Assisted Solution to solve my problem which was almost identical to what elevatedmarketing posted.

 Thanks, all!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.