Click to See Complete Forum and Search --> : File sending
bloke
08-12-2003, 10:50 AM
Hi guys
I want to send an attachment with a form, pretty much like this one.
I've not done this before but I've figured that I need to use
<input type="file" name="attachment">
...but I don't know what to do next! Ideally, I'd like to then mail the attachment using CDONTS. Can I do this?
If not, how do I retrieve the attachment on the form reciept page and perhaps save it to a location on the server or something?
Cheers
rdoekes
08-13-2003, 04:04 AM
Hi Bloke,
First of all, love your website. Already started cooking your recipes;)
here is a tread which handles the upload of a file to a server
http://forums.webdeveloper.com/showthread.php?s=&threadid=14705
With CDONTS.newmail you can then grab this file and attach it to an email. After that you may want to use the Scripting.FileSystemObject to delete the file from the server, if you want that.
-Rogier Doekes
bloke
08-13-2003, 04:08 AM
Hi Rogier
First, thanks. Glad you like the site!
I'll give that link a go. I did a bit of reading yesterday and that seems to be what it was getting at, just needed a pointer in the right direction.
Cheers!
rdoekes
08-13-2003, 04:10 AM
You're welcome, Bloke
bloke
09-01-2003, 05:30 AM
Still struggling with this one.
I've been looking at:
http://www.dataaccess.com/whitepapers/postingacceptor/UsingMSPostingAcceptor.html
and I'm pretty sure I've done everything I'm supposed to however I just can't get the damn thing to work. Has anyone ever used Posting Acceptor with asp?
Cheers
bloke
09-01-2003, 08:29 AM
Managed to upload a file. I'd ideally like to be able to email this to someone using cdonts. How do I go about that?
bloke
09-02-2003, 06:41 AM
Originally posted by rdoekes
Hi Bloke,
After that you may want to use the Scripting.FileSystemObject to delete the file from the server, if you want that.
-Rogier Doekes
Right, managed to do everything apart from delete the files after sending.
This:
arrX = split(strfilestring, "|")
dim filesys
for intx = lbound(arrX) to ubound(arrX)
objCDOMail.AttachFile Server.MapPath("../uploads/" & arrX(intx))
Set filesys = CreateObject("Scripting.FileSystemObject")
filesys.CreateTextFile "D:\intranet\uploads\"&arrX(intx), True
If filesys.FileExists("D:\intranet\uploads\"&arrX(intx)) Then
filesys.DeleteFile "D:\intranet\uploads\"&arrX(intx)
Response.Write("File deleted")
End If
next
attaches the correct files but the deletion doesn't work (although I get a message saying it has. Any clues?
Cheers
bloke
09-02-2003, 11:47 AM
I've moved the delete code to after Set objCDOMail = Nothing and this works fine, if anyone's interested!
Cheers