Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - File upload mod - help needed
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

File upload mod - help needed

 Post Reply Post Reply Page  <12
Author
Str8Dog View Drop Down
Senior Member
Senior Member


Joined: 18 December 2001
Location: United States
Status: Offline
Points: 2118
Post Options Post Options   Thanks (0) Thanks(0)   Quote Str8Dog Quote  Post ReplyReply Direct Link To This Post Posted: 19 October 2003 at 5:09pm
Simon,

You need to verify the select element is named in your html. Something like

<select name="myList">

If the form is submitted as POST, you can access the values like so:

Request("myList")

If the form is submitted as GET, you can access the values like so:

Request.QueryString("myList")
[IMG"> http://www.str8dog.com/images/str8dog.gif">
I wasn't born with enough middle fingers.
Back to Top
svpworld View Drop Down
Groupie
Groupie


Joined: 06 March 2003
Location: usa
Status: Offline
Points: 49
Post Options Post Options   Thanks (0) Thanks(0)   Quote svpworld Quote  Post ReplyReply Direct Link To This Post Posted: 19 October 2003 at 5:26pm

I did try this as you say, but the method aspupload (persits) works, it is not possible to request the form object variables in this way due to the multipart/form-data attribute in the upload form. However looking through persits application data it does offer two collections of its own, one of which is upload.form... I think I might be able to use this from the upload function somehow to get the variables... Anyway I'll try!

Thanks for your help.

Simon

Back to Top
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post Posted: 19 October 2003 at 9:22pm
Right, you need to use the upload component method to get POST data from the form. Also you can't get the thread_ID at the time of the upload cuz it's not assigned until after the post is submitted. I did this on my site and it's not a peace of cake, I wouldn't even do it for $20-$30, this is how I did it:

1. I added a file field at the bottom of the post form.

2. I created a new version of post_message.asp called post_message_attach.asp cuz you can't really use the same one to handle the upload, it would be too complicated since you can't use Request.Form.

3. Then I used javascript so that when there's a file on the file field the form will be send to post_message_attach.asp and change the encoding to multipart/form-data, otherwise it'll go to post_message.asp

4. On the post_message_attach.asp I changed all the Request.Form to objUpload.Form. Then first thing I do after all the authentication is upload the file, that way if something goes wrong you can send the user to the not_posted.asp (also have to mod it to show an error like wrong file size or wrong extension, the javascript checks the extension but it can be fooled, ASP can't be fooled)

5. I stored the upload filename in a new table on the db, just the filename and attachment ID.

6. Added a new field called attachment ID to tblThread and stored the attachment ID there.

7. Moded forum_posts.asp to show a link to the attachment at the bottom of the post.

8. Moded all the files that have to do with posts and topics deletion to delete the attachment.

9. I used the stream object to get the files for download and password protected the upload folder cuz I had problem with people leeching attachments on other sites. Can also be stored outside the webroot. I also added a referer check on the download files (made to files, one for images and one for downloads, the one for images displays the images and the other starts the attachment, they both check referers)

10. Write a script to delete attachments that where partially upload (i allow 2 mb uploads and sometimes they don't upload completely and part of the file stays on the server. I added this to the admin section.

11. Moded the permissions to add options to allow this attachment method separately from the other and even permissions for download, so I can even restrict some users from downloading attachments.

If you want to see it go to www.uznetworkz.com you will have to sign up, and if you do please send me a PM so I can delete your account.

I would post it as a mod but as you can see I've modded my forum so much that I would have to start it all over again and pretty much each and every file on the forum had to be modified for this.

Edited by fernan82
FeRnAN
Back to Top
svpworld View Drop Down
Groupie
Groupie


Joined: 06 March 2003
Location: usa
Status: Offline
Points: 49
Post Options Post Options   Thanks (0) Thanks(0)   Quote svpworld Quote  Post ReplyReply Direct Link To This Post Posted: 20 October 2003 at 6:24am

Thanks Fernan, you have given me some useful guidance!  I took a look at your site, had some problems though getting back in once I registered and I found your forum very slow.. is it access?

I probably dont need to implement the file upload into the post form as you have, my idea was to use the existing upload pop up form. I want to add a couple of drop down list menus on the form so users can specify what they upload and then read the values. I'll use the upoad component as you have confirmed, I assume I'll need to do this within the function somewhere?  Regarding the thread number, perhaps I can add something once the message is added, though I like the way you add the paper clip icon and track if the post is deleted to remove the file...

Thanks!

Simon

Back to Top
fernan82 View Drop Down
Mod Builder Group
Mod Builder Group
Avatar

Joined: 17 November 2002
Location: United States
Status: Offline
Points: 362
Post Options Post Options   Thanks (0) Thanks(0)   Quote fernan82 Quote  Post ReplyReply Direct Link To This Post Posted: 20 October 2003 at 7:24am
No prob., it's sql, probably something was going on when you visited as the site is known to be pretty fast unless I'm doing maintenance or something... Yes, you'll have to do it within the function cuz once you close the upload object you can't get the form anymore..., I just got the email, you didn't say if you get any errors or what the problem was but your account is fine, there's a link to resend the pwd on the main page, you can try that and make sure you didn't blocked my cookies.
FeRnAN
Back to Top
svpworld View Drop Down
Groupie
Groupie


Joined: 06 March 2003
Location: usa
Status: Offline
Points: 49
Post Options Post Options   Thanks (0) Thanks(0)   Quote svpworld Quote  Post ReplyReply Direct Link To This Post Posted: 21 October 2003 at 9:14am

Hi again Fernan,

I do like your file upload mod. Although I can probably manage most of this, I'm not too hot on Javascript... how did you manage to check if there is a filename in the file input box before posting the message?  Another thing I like about this mod is that is restricts users to uploading just one file per post. Ideally I want to display the attachments under each post from the show posts page, rather than just have url's in the messages (which can be deleted by the user too easily when editing their messages!)... Any more tips would be really appreciated!

Kindest regards
Simon

 

Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.