PDA

View Full Version : مشکل اساسی در upload کردن و نوشتن در database



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 &amp; getFileName(sHTMLFormField)
If Len( sNewFile) &lt;> 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 &amp;lt;FORM&amp;gt; field name &amp;lt;INPUT NAME=" &amp; sHTMLFormField &amp; "&amp;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]

M-Gheibi
یک شنبه 28 فروردین 1384, 17:43 عصر
شاید به دردتون بخوره :
http://support.persits.com/show.asp?code=PS01041843