[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

12/01/2008 at 04:04PM PST, ID: 23948453
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.0

How come a file being uploaded using Louis Motens' COM-Less software ASP solutions uploads an empty file?

Asked by pborregg in Adobe Dreamweaver, Active Server Pages (ASP)

Tags: Microsoft, ASP (Classic), Classic, Being used on Network Solutions servers

This question references: <b>How to upload a document, store its name and properties in a database, using ASP Classic with VB and do it for free!</b> and is a continuation....

I've used the solution referenced here: http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=8525&lngWId=4

But the problem is: when the file is uploaded it uploads EMPTY!!! Meaning, the name of the file is put on the server, but the contents of the file are missing and when you open it, there's nothing there.

Here's the modified code I've written:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#INCLUDE FILE="clsUpload.asp"-->
<%
'THIS WRITES TO THE DATABASE

Dim objUpload
Dim strFileName, strID, strPID, strDocCat, strDesc, strDocLoc, strDisp, strDateAdded, strBytes
Dim objConn
Dim objRs
Dim lngFileID

' Instantiate Upload Class
Set objUpload = New clsUpload

' Grab the form fields
strID = objUpload.Fields("ID").value
strPID = objUpload.Fields("PID").value
strFileName = objUpload.Fields("doc_name").value
strDocCat = objUpload.Fields("doc_category").value
strDesc = objUpload.Fields("description").value
strDocLoc = objUpload.Fields("DocLoc").value
strDisp = objUpload.Fields("display").value
strDateAdded = objUpload.Fields("date_added").value

'Response.Write(strID)
'Response.Write(strPID)
'Response.Write(strFileName)
'Response.Write(strDocCat)
'Response.Write(strDesc)
'Response.Write(strDocLoc)
'Response.Write(strDisp)
'Response.Write(strDateAdded)

Set objConn = Server.CreateObject("ADODB.Connection")
Set objRs = Server.CreateObject("ADODB.Recordset")

' Sometimes I personally have errors with one method on different servers, but the other works.
'objConn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("Files.mdb")
'objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Files.mdb")
'ACCESS
'objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=F:\\0\\1\\131\\30\\1620682\\user\\1746753\\htdocs\\db\\dbname.db;UID=userid;PWD=password;Persist Security Info=False"
'MS SQL
objConn.Open "Provider=sqloledb; Data Source=205.178.152.124; Initial Catalog=webprojectsql; User Id=F:\0\1\131\30\1620682\user\1746753\htdocs\db\dbname.db; User Id=userid; Password=password"


objRs.Open "documents", objConn, 3, 3

objRs.AddNew

objRs.Fields("ID").Value = strID
objRs.Fields("PID").Value = strPID
objRs.Fields("doc_name").Value = strFileName
objRs.Fields("doc_category").Value = strDocCat
objRs.Fields("doc_description").Value = strDesc
objRs.Fields("doc_location").Value = strDocLoc
objRs.Fields("active").Value = strDisp
objRs.Fields("date_added").Value = strDateAdded

objRs.Update
objRs.Close
lngFileID = strID
%>
<%
'THIS WRITES TO THE FILE SYSTEM!
Dim strPath

' Grab the file name
' strFileName = objUpload.Fields("doc_name").FileName

' Compile path to save file to
' strPath = Server.MapPath("Uploads") & "\" & strFileName
strPath = "F:\0\1\131\30\1620682\user\1746753\htdocs\webproject\content" & "\" & strFileName

'Response.Write(strPath)

' Save the binary data to the file system
objUpload("doc_name").SaveAs strPath

' Release upload object from memory
Set objRs = Nothing
Set objConn = Nothing
Set objUpload = Nothing
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document Saved</title>
<link href="css/general.css" rel="stylesheet" type="text/css" />
<table width="35%" border="0" align="center" cellpadding="3" cellspacing="2" class="silverinset">
  <tr class="titlecentercell">
    <td>Your Document, <%= strFileName %>, has been saved successfully and uploaded!</td>
  </tr>
  <tr>
    <td align="center"><input name="goBack" type="button" class="small" onclick="location.href='list-subproject-items.asp?pid=<%= Session("SV_PID") %>'" value="Return to Project Detail" /></td>
  </tr>
</table>

<p>&nbsp;</p>
</body>
</html>

It all works fine, again, except the file contents are NOT uploaded with the file name. It's empty and all that's there is a 1K file with a name and nothing in the file itself.

Thanks.

Peter
 
Keywords: How come a file being uploaded using …
 
Loading Advertisement...
 
[+][-]12/02/08 12:00 AM, ID: 23075116

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/03/08 04:54 PM, ID: 23091855

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/03/08 05:40 PM, ID: 23092043

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/03/08 07:10 PM, ID: 23092387

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/03/08 07:15 PM, ID: 23092408

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]12/03/08 07:16 PM, ID: 23092413

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/04/08 08:15 AM, ID: 23096625

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]12/26/08 07:37 AM, ID: 23245295

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Adobe Dreamweaver, Active Server Pages (ASP)
Tags: Microsoft, ASP (Classic), Classic, Being used on Network Solutions servers
Sign Up Now!
Solution Provided By: pborregg
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20090824-EE-VQP-74 - Hierarchy / EE_QW_2_20070628