تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
تطبيق منقول - عمل Uplodad من خلال ASP
#2

كود :
'Creates a raw data file For With all
'data sent. Uncomment for debuging.
if Raw Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(SavePath & "\raw.txt", ForWriting, True)
f.Write strDataWhole
Set f = nothing
Set fso = nothing
End if

كود :
[align=left] 'Get first file boundry positions.
lngCurrentBegin = instr(1,strDataWhole,strBoundry)
lngCurrentEnd = instr(lngCurrentBegin + 1,strDataWhole,strBoundry) - 1

countloop = 0
Do While lngCurrentEnd > 0
'Get the data between current boundry
'and remove it from the whole.
strData = mid(strDataWhole,lngCurrentBegin, (lngCurrentEnd - lngCurrentBegin) + 1)
'Remove the file data from the whole
'strDataWhole = replace(strDataWhole,strData,"")

'Get the full path of the current file.
lngBeginFileName = instr(1,strdata,"filename=") + 10
lngEndFileName = instr(lngBeginFileName,strData,chr(34))
'Make sure they selected at least one
'file.
if lngBeginFileName = lngEndFileName and lngNumberUploaded = 0 Then
Response.Write "[color=#000080]<H2>[/color] The following Error occured.[color=#000080]</H2>[/color]"
Response.Write "You must Select at least one file To upload"
Response.Write "[color=#000080]<BR>[/color][color=#000080]<BR>[/color]Hit the back button, make the needed corrections and resubmit your information."
response.Write "[color=#000080]<BR>[/color][color=#000080]<BR>[/color][color=#ff8000]<INPUT type='button' onclick='history.go(-1)' value='<< Back' id='button'1 name='button'1>[/color]"
Response.End
End if
'There could be one or more empty file b
'
'
' oxes.
if lngBeginFileName <> lngEndFileName and lngBeginFileName - 10 <> 0 Then
strFilename = mid(strData,lngBeginFileName,lngEndFileName - lngBeginFileName)
'Creates a raw data file with data
'between current boundrys. Uncomment
'for debuging.
if Boundry Then
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(SavePath & "\raw_" & lngNumberUploaded & ".txt", ForWriting, True)
f.Write strData
Set f = nothing
Set fso = nothing
End if
'Loose the path information and keep
'just the file name.
tmpLng = instr(1,strFilename,"\")
Do While tmpLng > 0
PrevPos = tmpLng
tmpLng = instr(PrevPos + 1,strFilename,"\")
Loop
FileName = right(strFilename,len(strFileName) - PrevPos)
'Get the begining position of the file
'data sent.
'if the file type is registered with
'the browser then there will be a
'Content-Type
lngCT = instr(1,strData,"Content-Type:")
if lngCT > 0 Then
lngBeginPos = instr(lngCT,strData,chr(13) & chr(10)) + 4
Else
lngBeginPos = lngEndFileName
End if
'Get the ending position of the file
'data sent.
lngEndPos = len(strData)
'Calculate the file size.
lngDataLenth = (lngEndPos - lngBeginPos) -1
'Get the file data
strFileData = mid(strData,lngBeginPos,lngDataLenth)
'Create the file.
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(SavePath & "\" & FileName, ForWriting, True)
f.Write strFileData
Set f = nothing
Set fso = nothing
'Log Upload Informatoin.
rstLog.AddNew
'Log the Date and time, the IP, the Path, and the Filename
rstLog(0) = Now()
rstLog(1) = request.ServerVariables("REMOTE_ADDR")
rstLog(2) = SavePath
rstLog(3) = FileName
rstLog.Update

if lngNumberUploaded = 0 Then
Response.Write "[color=#000080]<STRONG>[/color]Saving Files...[color=#000080]</STRONG>[/color][color=#000080]<BR>[/color][color=#000080]<BR>[/color]"
End if
Response.Write SavePath & "\" & FileName & "[color=#000080]<BR>[/color]"

lngNumberUploaded = lngNumberUploaded + 1
End if
'Get then next boundry postitions if
'any.
lngCurrentBegin = lngCurrentEnd
lngCurrentEnd = instr(lngCurrentBegin + 9 ,strDataWhole,strBoundry) - 1
'Prevents infinate loop.
countloop = countloop + 1
if countloop = 100 Then
Response.Write "looped 100 times terminating script!"
'Close the Log
if rstLog.State Then rstLog.close
if conn.State Then conn.Close
Response.End
End if
loop
'Close the Log
if rstLog.State Then rstLog.close
if conn.State Then conn.Close
Response.Write "[color=#000080]<STRONG>[/color]" & lngNumberUploaded & " File(s) Uploaded[color=#000080]</STRONG>[/color]"
Response.Write "[color=#000080]<BR>[/color][color=#000080]<BR>[/color][color=#ff8000]<INPUT type='button' onclick='document.location=" & chr(34) & "saveany.asp" & chr(34) & "' value='<< Back to Upload' id='button'1 name='button'1>[/color]"
Case 3
'get prev path if any
path = Request.QueryString("Path")
'if Not assign one
if path = "" or isempty(path) Then
path = server.MapPath(".")'"c:\inetpub"
End if
'create filesystemobject
Set fso = CreateObject("Scripting.FileSystemObject")
'get a folder object
Set f = fso.GetFolder(path)
path = f.path
'limit access To hard drive
'if lcase(left(path,10)) <> "c:\inetpub" Then
' path = "C:\Inetpub"
' Set f = fso.GetFolder(path)
' path = f.path
'End if
Response.Write "[color=#000080]<H2>[/color]Server Browse Form.[color=#000080]</H2>[/color]"
Response.Write "[color=#ff8000]<FORM ACTION='saveany.asp?func=1' METHOD=POST>[/color]"
Response.Write "[color=#008080]<TABLE width=400 border=1 cellpadding=0 cellspacing=1>[/color]" & vbcrlf
Response.Write "[color=#008080]<TR>[/color][color=#008080]<TH colspan=2>[/color]" & path & "[color=#008080]</TH>[/color][color=#008080]</TR>[/color]"
Response.Write "[color=#008080]<TR>[/color][color=#008080]<TD colspan=2 align=left>[/color][color=#008000]<A href='saveany.asp?func=3&path=" & path & "\..'>[/color][color=#000080]<STRONG>[/color]Parent ..[color=#000080]</STRONG>[/color][color=#008000]</A>[/color][color=#008080]</TD>[/color][color=#008080]</TR>[/color]" & vbcrlf
'get subfolders collection
Set fc = f.subfolders
'enum subfolders
For Each folder In fc
Response.Write "[color=#008080]<TR>[/color][color=#008080]<TD align=left>[/color][color=#ff8000]<INPUT NAME=BrowseServer TYPE=CheckBox Value='" & folder.path & "'>[/color][color=#008080]</TD>[/color][color=#008080]<TD style='padding-left: 20px;' align=left>[/color][color=#008000]<A href='saveany.asp?func=3&path=" & folder.path & "'>[/color]" & folder.name & "[color=#008000]</A>[/color][color=#008080]</TD>[/color][color=#008080]</TR>[/color]" & vbcrlf
Next
'if there is a folder display the Select folder button
if fc.count > 0 Then
Response.Write "[color=#008080]<TR>[/color][color=#008080]<TD align=left colspan=2>[/color][color=#000080]<BR>[/color][color=#ff8000]<INPUT name=submit type='submit' value='Select Folder'>[/color][color=#008080]</TD>[/color][color=#008080]</TR>[/color]"
End if
Response.Write"[color=#008080]<TR>[/color][color=#008080]<TD colspan=2>[/color][color=#ff8000]<INPUT name=cancel type='Button' value='Cancel' onclick=document.location='saveany.asp?func=1'>[/color][color=#008080]</TD>[/color][color=#008080]</TR>[/color]"
Response.Write "[color=#008080]</TABLE>[/color]" & vbcrlf
Response.Write "[color=#ff8000]</FORM>[/color]"
End Select
%>
[color=#000080]</BODY>[/color]
[color=#000080]</HTML>[/color]
[color=#800000]<SCRIPT LANGUAGE=vbscript RUNAT=Server>[/color]
function ParseForm(strFieldName)
Set strFormData = CreateObject("Scripting.Dictionary")
lngCount = -1
'Try To find the Field
lngNamePos = instr(1,strDataWhole,"name=" & chr(34) & strFieldName & chr(34))
'Parse through data In search of fields
Do While lngNamePos <> 0
lngCount = lngCount + 1
lngBeginFieldData = instr(lngNamePos,strDataWhole,vbcrlf & vbcrlf)+4
lngEndFieldData = instr(lngBeginFieldData,strDataWhole,strBoundry)-2
strFormData.Add lngCount, mid(strDataWhole,lngBeginFieldData,lngEndFieldData-lngBeginFieldData)
lngNamePos = instr(lngEndFieldData,strDataWhole,"name=" & chr(34) & strFieldName & chr(34))
Loop
Set ParseForm = strFormData
End function
function CreateDatabase
'on Error Goto 0
'create an instance of a catalog(Database)
Set cat = server.createobject("ADOX.Catalog")
'create the catalog
cat.Create ("Provider='Microsoft.Jet.OLEDB.4.0';Data Source='c:\inetpub\UploadLog.mdb'")
Set connNew = cat.ActiveConnection
connNew.CursorLocation = 3
'get the Connection and add a Table and the following fields
connNew.execute "Create Table [Logs]"
connNew.execute "Alter Table [Logs] Add Column [DateTimeStamp] DATETIME"
connNew.execute "Alter Table [Logs] Add Column [IP Address] TEXT(15)"
connNew.execute "Alter Table [Logs] Add Column [Path] TEXT(100)"
connNew.execute "Alter Table [Logs] Add Column [File] TEXT(100)"
connNew.execute "Alter Table [Logs] Add Column [Notes] MEMO"
'clean up
connNew.close
Set connNew = nothing
Set cat = nothing
End function
[color=#800000]</SCRIPT>[/color]
[/align]
}}}
تم الشكر بواسطة:


الردود في هذا الموضوع
تطبيق منقول - عمل Uplodad من خلال ASP - بواسطة Raggi Tech - 17-10-12, 10:43 PM


التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم