mraminr
سه شنبه 23 فروردین 1384, 07:34 صبح
دوستان سلام
توی یه فرم میخوام یه فایل به سرور load کنم و در ضمن چندتا فیلد دیگه هم که توی همون فرم پر میشن رو توی database وارد کنم. برای upload از یه تابع استفاده کردم که بدنه اصلی اون این تابع است :
<span dir=ltr>
Function saveAs( sHTMLFormField, sNewFile)
If Dict.Exists(sHTMLFormField) And Len(getFileName(sHTMLFormField)) > 0 Then
binData = Dict.Item( sHTMLFormField).Item("Value")
binData = getString( binData)
Dim sFilePath
sFilePath = Path & getFileName(sHTMLFormField)
If Len( sNewFile) <> 0 Then sFilePath = sNewFile
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject") '- create the transfer file using Scripting.FileSystemObject ...
Set oTextStream = oFSO.CreateTextFile( sFilePath, True) '- create a file binary write
oTextStream.Write( binData) '- write binData to the file
oTextStream.Close '- close the file
set oFSO = nothing
saveAs = True
Else
'Response.Write( "File associated with HTML &lt;FORM&gt; field name &lt;INPUT NAME=" & sHTMLFormField & "&gt; not found!")
saveAs = False
End If
End Function
</span>
البته فایل مورد نظر upload میشه اما موقعی که می خواد اطلاعات فیلدهای بعدی رو (که میخوام با request.form بخونم ) رو توی database بنویسه این error رو می ده :
<span dir=ltr>
Error Type:
Request object, ASP 0208 (0x80004005)
Cannot use the generic Request collection after calling BinaryRead.
</span>
لطفا راهنمایی کنید
با تشکر[/list]
توی یه فرم میخوام یه فایل به سرور load کنم و در ضمن چندتا فیلد دیگه هم که توی همون فرم پر میشن رو توی database وارد کنم. برای upload از یه تابع استفاده کردم که بدنه اصلی اون این تابع است :
<span dir=ltr>
Function saveAs( sHTMLFormField, sNewFile)
If Dict.Exists(sHTMLFormField) And Len(getFileName(sHTMLFormField)) > 0 Then
binData = Dict.Item( sHTMLFormField).Item("Value")
binData = getString( binData)
Dim sFilePath
sFilePath = Path & getFileName(sHTMLFormField)
If Len( sNewFile) <> 0 Then sFilePath = sNewFile
Set oFSO = Server.CreateObject( "Scripting.FileSystemObject") '- create the transfer file using Scripting.FileSystemObject ...
Set oTextStream = oFSO.CreateTextFile( sFilePath, True) '- create a file binary write
oTextStream.Write( binData) '- write binData to the file
oTextStream.Close '- close the file
set oFSO = nothing
saveAs = True
Else
'Response.Write( "File associated with HTML &lt;FORM&gt; field name &lt;INPUT NAME=" & sHTMLFormField & "&gt; not found!")
saveAs = False
End If
End Function
</span>
البته فایل مورد نظر upload میشه اما موقعی که می خواد اطلاعات فیلدهای بعدی رو (که میخوام با request.form بخونم ) رو توی database بنویسه این error رو می ده :
<span dir=ltr>
Error Type:
Request object, ASP 0208 (0x80004005)
Cannot use the generic Request collection after calling BinaryRead.
</span>
لطفا راهنمایی کنید
با تشکر[/list]