Click to See Complete Forum and Search --> : File Uploading problem


Gopinath
09-16-2003, 04:02 AM
I have problem in file uploading. I attached my code. Pls go through it, and find the problem and give me a solution
But it shows, file is uploaded. When check the file in Windows Explorer, it does not exist. Pls give me a solution
<%
dim oUpload
Set oUpload = Server.CreateObject("ASPPW.Upload")
oUpload.RejectEmptyExtension = True 'True/False
oUpload.FileExtensionList "txt", "gif" ,"jpg", "*" 'remove '*', if you don't allow all types
oUpload.RegistrationCode = 670920731013 'String expression
oUpload.RemoveUploadedFilesOnError = True 'True/Falses
Set oForm = oUpload.Form
'Save uploaded file here.
oUpload.UpLoadPath = Server.mappath(".")&"\LessonContent" '/inetpub/wwwroot/upload
file_doc = split(time(),":")
file_doc1 = split(file_doc(2)," ")
file_date=split(date(),"/")
profix=file_date(0)&file_date(1)&file_date(2)&file_doc(0)&file_doc(1)&file_doc1(0)&"_"
oupload.SaveFileWithPrefix= profix

i = oUpload.Upload
if i=1 then
Response.Write("Uploaded")
else
Response.Write ("Problem")
end if
%>

Thankz in advance
-Gopi:confused:

rdoekes
09-16-2003, 10:36 AM
I advice you to contact the support group for this component or check their documentation or FAQ.

-Rogier Doekes

Tikki
09-16-2003, 02:01 PM
Hello Gopinath,
for file upload problem click on this link
http://www.dalun.com/viewcode.asp?file=fupload.asp
u will find the solution. if not u can mail your problem to techinical support team. if not please let me know, i will tell u the solution
-------------------------------------------------------------
Try this also:

<%
Dim FileDesc(1)

On Error Resume next

DD = DAY(NOW)
MON = MONTH(NOW)
YY = YEAR(NOW)
HH = HOUR(TIME)
MM = MINUTE(TIME)
SS = SECOND(TIME)
KEY = DD & MON & YY & HH & MM & SS

Set oUpload = Server.CreateObject("ASPPW.Upload")
oUpload.SaveFileWithPrefix=KEY&"_"
oUpload.UserDiskQuota= 10 * 1024 * 1024
oUpload.RejectEmptyExtension = True 'True/False, Mac user sets it to false.
oUpload.FileExtensionList "pdf"
oUpload.RegistrationCode = "enter the code here" 'String expression
oUpload.RemoveUploadedFilesOnError = True 'True/Falses

oUpload.UpLoadPath = Server.mappath("give file path here")


i = oUpload.Upload

If Err.Number <> 0 Then
'Response.Write("xyx.....")
'Response.End
End if

Select Case i
case 1
sMsg = "File uploading ends normally."
Case -4
sMsg = "User's disk quota full. Max size of file: 10 MBytes"
Case -5
sMsg = "Path on Server for uploading not found or invalid. " & _
"A possible cause is that your IUSR_??? account doesn't have a permission to create a diretory for storing uploaded files."
Case -6
sMsg = "A file type for uploading is not allowed."
Case -7
sMsg = "Uploading exception."
Case -8
sMsg = "File access failure. Check the permission of the directory, Add R/W/D to IUSR_??? account."
Case -9
sMsg = "Bad Content Header."
Case -11
sMsg = "Exception when loading BLOB field."
case else
sMsg = "Exception. Error Code is: " & i & "."
End Select

If i <> 1 Then
Response.write "!! Fehler beim File Transfer:" + sMsg
If oUpload.GetLastErrNum <> 0 Then
Response.write "Error: " & oUpload.GetLastErrDescription & "
"
End if
Response.END
End if

Set oForm = oUpload.Form 'return a Collection
Set oFiles = oUpload.UploadedFileInfo 'return a Collection


Set item = oFiles.item(I) 'Sample operation to a collection, index starts from 1
WholePath = oUpload.UpLoadPath & item.Filename
%>
--------------------
hope this will solve ur problem