Solved

Uplaod a Word Document Using aspsmartupload

Posted on 2000-05-07
7
440 Views
Last Modified: 2008-02-01
When we try to upload a document using aspsmartupload the file filed is used to choose a file . the <form> tag should have the enctype set to multipart/form-data the only it will work. If i use the enctype the data has to be requested using request.binaryread.Along with the file field i also have other text fields for getting other info. i can't have two forms.
How can i use the file fields for uploading and other text fields inside the same form
0
Comment
Question by:indu_ma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 6

Expert Comment

by:setiawan
ID: 2787138
Hi indu_ma,

make your text hidden
<input type="hidden" name="txt" value="your value">

hope this helps

  danny
0
 
LVL 2

Author Comment

by:indu_ma
ID: 2787152
If i put the value inside a hidden field again after submiiting how can i retrieve . iam not able to use request.form since i use the enctype if i take that i am not able to upload
0
 

Expert Comment

by:vishalsalian
ID: 2791572

Try using
aspsmtupl.form("Yourformfieldname") where 'aspsmtupl' is your aspsmartupload object.I have used a similar kind of thing in SAFileupload component and it works there.

Vishal

0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:indu_ma
ID: 2791639
Not clear with the answer given . I again explain my problem

I have a Screen where in i get a person details along with the details i have to get the resume of him/her . i have to upload the word doc in a folder in my server. for uploading i use aspsmartupload and it works fine .Inside my form tag i have textfields where in i get his/her name and other details atlast i use file field which has a browse button to choose the file to upload . Suppose i use file field for uploading i should have the form tag as

<FORM METHOD="POST" ACTION="Upload.asp" ENCTYPE="multipart/form-data" id=form1 name=form1>
 the enctype should be set but if i use that then while requesting i have to use request.binaryread  to request other details like name i have to use request.form
how to join both retrieval of other details and upload inside same form

0
 

Expert Comment

by:vishalsalian
ID: 2792575
Just try the code below .

Dim uploadfile
dim x

set uploadfile = Server.CreateObject("aspSmartUpload.SmartUpload")
uploadfile.upload   'This will upload your file

' Specify the virtual folder on your server.
 path = Server.mappath("/yourdomain/foldertobeuploaded")
 x=uploadfile.save(path)


' You can get the values of the other fields in the form using the
' following .

 For each fieldname In uploadfile.Form
         For each fieldvalue In uploadfile.Form(fieldname)
             Response.write fieldvalue
             ' The fieldvalue contains the value of your other fields in the form
     Next
 Next
 

Just try the code above,I guess this should help you to retrieve other fields in the form .

You can check the documentation of aspsmartupload at the following link
http://www.aspsmart.com/scripts/download/downloadfree.asp

On downloading the component,you have some sample codes along with it which should be able to help you.

Best Regards,
Vishal
0
 
LVL 2

Author Comment

by:indu_ma
ID: 2795396
uploadfile.form in the for loop is giving a error

I have two fields like Empno,empname for saving the data into the database i use the insert statement has

<% cn.execute "insert into emp values ('"&request.form("empno")&"','"&request.form("empname")&"')
%>

The empno and ename textfield are under the form tag.
suppose i want to upload the resume of the employee i added the file field inside the form tag . for the upload to work the enctype attribute of the form tag should be set to multipart/form-data.
if i set this it gives error in the insert statement has Request.BinaryRead has to be used to request data.
what to do
0
 

Accepted Solution

by:
vishalsalian earned 50 total points
ID: 2795896
Hi ..

You need not use request.form at all for your problem.You can get your job  done as below .

Consider a sample htm below :
<html>
<form METHOD="POST" ACTION="test.asp" NAME="testform" ENCTYPE="multipart/form-data">
      File to be uploaded <input type=FILE name="file1"><br>

      Empno <input type=text name="no"><Br>
      Empname <input type=text name="name"><br>

         <input type="submit" value="upload">
</form>
</html>
This file has 2 field apart from the uploading field.The code for test.asp is as below .It takes care of uploading your file and writing the values of other fields in the database.
-------------------------------
<%
    dim x
  set upl = Server.createobject("aspsmartupload.smartupload")

    upl.upload
   x = upl.save("/somefolder on your server")

    'You can access the  name and  empno field   in the form as below

     name = upl.form("name")
     empno= upl.form("no")

 cn.execute "insert into emp values ('"&no &"','"& name &"')

 %>

 Just try the code above.Hopefully it should solve your problem.

Regards,
Vishal

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question