Link to home
Start Free TrialLog in
Avatar of blurredvision
blurredvision

asked on

File upload script working on local server but not remote server despite READ/WRITE permissions set correctly

I have been using Lewis Moten's script for file uploading, ensuring unique filenames, limited filesize and file extensions

[http://www.planet-source-code.com/vb/scripts/ShowCode.asp?txtCodeId=8525&lngWId=4]

I have deployed it successfully on a number of sites, but I have now encountered an issue that i cannot resolve,

I have the script working fine on my local server (IIS) but on the remote hosting server it presents as though it is working fine, gives no errors, but files do not upload!

Does anyone have any ideas? The folder it is uploading has READ/WRITE permissions for the ASP USER, and i would presume there would be error messages if this wasn't the case anyway.

The script that i'm using to call the upload is:

<!--#INCLUDE FILE="clsUpload.asp"-->
<%
Dim Upload
Dim FileName
Dim Folder

Set Upload = New clsUpload
name = Upload("name").Value
email = Upload("email").Value
comments = Upload("comments").Value
agree = Upload("agree").Value

' If file size is greater then 1 MB
If Upload("File1").Length > 2548576 Then

      ' Notify user of the error.
      Response.Write "File size must be 2 megabytes or less"
      
      ' Stop all execution past this line.
      Response.End
      
End If


' Grab the file name
FileName = Upload.Fields("File1").FileName

' Grab file extension
Ext = Upload.Fields("File1").FileExt

' Check to see if file extension is valid

      Select Case Ext
            Case "GIF", "BMP", "PNG", "JPG", "TIFF", "TIF", "DOC", "RTF", "PDF", "EPS", "JPEG"
                  FileOK = True
            Case Else
                  FileOK = False
      End Select

      ' If file was not valid
            If Not FileOK Then
                  ' Notify user of error
                        Response.Write "Invalid file extension."
      
                  ' Stop all execution after this line.
                        Response.End
            End If


' Get path to save file to
Folder = Server.MapPath("subs") & "\"

' Set the file name to be unique.
FileName = Upload.UniqueName(Folder, FileName)

' Save the binary data to the file system
Upload("File1").SaveAs Folder & FileName

' Release upload object from memory
Set Upload = Nothing
%>
ASKER CERTIFIED SOLUTION
Avatar of bigbillydotcom
bigbillydotcom

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of blurredvision
blurredvision

ASKER

Thanks BBDC, I'll check those settings with the server admin but it may take a couple of days to get a response out of him...
Ok, serveradmin guy actually logged on over the weekend and did update the permissions (in fact, he confirmed that the previous permissions change hadn't been made -- which makes me wonder why I didn't receive an error message!).

Anyway, all working now - thanks BBDC!