[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

Simple file upload form

I'm looking for an example page that only contains a form from which the user can upload a file to my web site.  I'm trying to give my customers the ability to send me files in the most user friendly way available.  I'm kinda picky, but it pays well.  If you have any other questions, let me know...  I'll be around often.
0
Smokintbird
Asked:
Smokintbird
  • 14
  • 13
1 Solution
 
ClassyLinksCommented:
Not only do you need the form, you need a way to tell the server where to save it.  I use ASPUpload for this.  
Here's an example.

<%
If Request.QueryString("action") = "upload" Then
Set Upload = Server.CreateObject("Persits.Upload.1")
Upload.Save ("path to your folder\foldername")
%>
     <center>
     <h4>File was successfully uploaded!</h4>    
<%          
End If
%>

<form name="frmUpload" enctype="multipart/form-data" method="POST" action="WPupload.asp?action=upload">
   <h1 align="center"><b><font color="#CC9900">Select a file to upload:&nbsp;</font></b></h1>
  <p align="center">
       <input type="file" name="upload" size="38"></p>
  <p align="center"><input type="submit" value="Upload Now!"></p>
</form>



If you cannot use ASP let me know...I'll try to find you another option.
0
 
SmokintbirdAuthor Commented:
Well, I don't know jack about "asp" except that it's a web component.  I'm a Visual Basic programmer, with some decent experience with javascript, dreamweaver and front page 2000, but I'm not sure what you're talking about.  My web host supports front page server extensions, but I'm not sure of much more that that.  The provider is "www.atfreeweb.com", I hope that helps...  
0
 
ClassyLinksCommented:
Well, the good new is you are on a windows server.....but they don't explicitly say that ASP is available...except in the premium plan.

Make a page call test.asp and try this as the code:
<%
response.write "This is a test"
%>

If the words This is a test are written when you call up the page then you can use asp.  However...they haven't completed the page where they tell you how to upload on to your server.  http://www.atfreeweb.com/resources/ASP.htm

I would suggest sending them an email asking what upload component they support.
0
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
SmokintbirdAuthor Commented:
ok...   that worked just fine when I typed it in by hand, so it aparently supports ASP...   now what?
0
 
ClassyLinksCommented:
From Above:

>>I would suggest sending them an email asking what upload component they support.
*********************
As a starter....your form needs to contain
<input type="file" name="upload" size="38">

But how you tell the server what to do with it depends on the components they have installed.

Pop off a quick email and see what they say.
0
 
ClassyLinksCommented:
Try the script I orignally posted.  ASPUpload is one of the more popular components they could be using.
0
 
SmokintbirdAuthor Commented:
I've got an email in to them, and I'm waiting for a response, so I've not forgotten you, just waiting for their awnser.
0
 
ClassyLinksCommented:
Great!  When you find out, we can continue....not much point otherwise...it would be "reinventing the wheel".
0
 
SmokintbirdAuthor Commented:
I'm begining to have doubts about my web site host...
anyway, after unawnsered emails, I finally called them.  they said that they support all of the components that come with windows 2000 server, with the service pack 2.  they also said that they knew that they supported the "file system object".  I personally have no clue what they are talking about, but was hoping that you would.  They also promised that I would recieve a reply to my emails, by someone who knew more about what I was asking.  So...   hopefully I will be able to provide you with more information if you need it.   what do you think?  does this tell you anything usefull, or do we continue to wait?
0
 
SmokintbirdAuthor Commented:
Oh yea...  they also said that if you had a URL to where they could find information about the component and maybe where to download it, they would "consider" whether they would put it on my server.
0
 
SmokintbirdAuthor Commented:
I finally recieved an email from them, and it reads:

We commonly suggest our users use FileSystem Object and asp codes to
make the upload function.
If you want us to set any free component on the server for you, please
give us the related URL. We will evaluate it first and install it for
you.

Thank you for using AtFreeWeb.com.

0
 
SmokintbirdAuthor Commented:
I also set the visitor write permission to a folder in my web named "upload".  I think we've got everything we need to continue, let me know what you think.
0
 
ClassyLinksCommented:
Here's a cgi form that will do the trick for you....

http://www.terminalp.com/cgi-bin/dc.pl?url=/uploadtest.html

And here is a JavaScript alternative...

http://javascript.internet.com/forms/upload-filter.html

But the one I like to use (as outlined above) is ASPUpload.

http://www.aspupload.com
0
 
SmokintbirdAuthor Commented:
ok...  I see how these exapmles work, but I'm not sure what to do with them to make them work for me.
I've tried the javascript code, and it references a "some-script.cgi" which script do I use and where do I put it?
I've tried using the CGI example, but where do I get the script and what do I do with it? I tried downloading their script, but all I ever get when I try to use it, is "page cannot be displayed".  I tried using the file-upload.cgi from the CGI example, and putting it in a CGI-BIN directory on my web, and using both examples of forms, yet I keep getting the "page cannot be displayed".  
As I said in my original question, I'm not an expert at web programming, but by now, this should be prety clear.
0
 
ClassyLinksCommented:
<Classy gives her head a shake>

You can use ASP...so why are we goofing around with CGI???

First...give the www.aspupload.com link to your server host.  If they don't already have an upload component on
thier site, they should!

Any way....

Here is a great article on how to do it quite easily with ASP.  No components needed other than VB needs to be installed on the server.

http://www.asp101.com/articles/jacob/scriptupload.asp

There is even a link to a zip file that not only has the script, but a working example and a readme file.

http://www.asp101.com/articles/jacob/fileuploader.zip
0
 
ClassyLinksCommented:
smokin.....how's it going?
0
 
SmokintbirdAuthor Commented:
no luck...   either they don't support the method I'm using, or else I just don't know what I'm doing.  The latter is more likely the problem.  I told you to start with, that I didn't know anything about ASP.  You've sent me these links, and I don't understand much of what they are saying.  I've tried their examples, and they work like a champ, but when I try to modify them for my page, they no longer work.  I'm pretty much out of Ideas.  If there is anything else you can contribute, I would appreciate it, because what you've sent me doesn't work.
0
 
ClassyLinksCommented:
Can you show me what you've got, and indicate exactly what errors you are getting?
0
 
SmokintbirdAuthor Commented:
' Check where the user wants to save the file
If Uploader.Form("saveto") = "disk" Then
     
' Save the file
File.SaveToDisk "E:\UploadedFiles\"

This part is giving me problems...
I'm not sure what the pat is.
I've tried "www.mysite.com/upload"
I've tried "(Drive):/users/catkinson2000/upload"
(using C: through J:)

none of these has worked.
Any Ideas?  I'm drawing a blank at this point.
is there anything else I need to change?
0
 
ClassyLinksCommented:
What error message is it giving you?  Do you have Write permissions on the Uploadedfiles directory?
0
 
SmokintbirdAuthor Commented:
it's just giveing me the page cannot be displayed error.

I'm trying to modify the "uploadexmple.asp"...
should I be modifying the "upload.asp"???  
0
 
SmokintbirdAuthor Commented:
ok...   I deleted the files I was trying to use, and started fresh with newly downloaded files.
The only thing I changed was the line in "uploadexple.asp" that said:
File.SaveToDisk "E:\UploadedFiles\"

I changed it to:
File.SaveToDisk "http://www.theatkinsonfamily.org/upload"

It apears to be working, but I'm not finding the files it says are being uploaded.
I set up the "www.theatkinsonfamily.org/upload" folder to allow user upload.

There's got to be something I'm not doing, or not doing right.  
Any Ideas?
0
 
ClassyLinksCommented:
ok...usually you cannot save in this method to an http address.  You will have to figure out the server's actual path to this file.

This is for security reasons.  If you could to it that way, you could upload to any server in the world!

Let's try to get the server to spit out it's address.

Response.Write Server.MapPath("../")

This will get the page to write the actual server address of the directory ABOVE the one this page is in.  Then you will know what to put in your SaveToDisk parameter.  The results may surprise you...many webservers have you lodged in hidden directories you's never guess about!
0
 
ClassyLinksCommented:
Just as a point of interest:

visit http://mysite.classylinks.ca/_sitepages/pictures and you will see how I've done it as a demo for potential clients.  Mine is set up only to upload pics, but it is the same basic principle.
0
 
SmokintbirdAuthor Commented:
FINALLY!!!

It worked.

I appreciate all your help.

Later.
0
 
SmokintbirdAuthor Commented:
Well worth the points!
enjoy all 1200 expert points...
0
 
ClassyLinksCommented:
Hurray!  More important that you got it working than the points, but thanks!

Come back any time.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

  • 14
  • 13
Tackle projects and never again get stuck behind a technical roadblock.
Join Now