stuffradio
03-29-2007, 03:59 PM
I'm trying to use AJAX with PHP to upload some attatchments to a server, then use those attachments to email to a list of emails... any ideas of a simple solution?
![]() | View Full Version : ajax/php email stuffradio 03-29-2007, 03:59 PM I'm trying to use AJAX with PHP to upload some attatchments to a server, then use those attachments to email to a list of emails... any ideas of a simple solution? mikey1090 03-29-2007, 04:22 PM what do you have so far? stuffradio 03-29-2007, 04:42 PM just the html part, don't want the page to refresh... hence I'm using AJAX mikey1090 03-29-2007, 04:46 PM have you made a form? have you ever used AJAX before? stuffradio 03-29-2007, 04:58 PM I know how to do the PHP part of the Email... just not AJAX mikey1090 03-29-2007, 05:00 PM you should read some tutorials then no point diving in if you know nothing, you could make a real mess of it w3 schools has a good tutorial Ks Jeppe 03-29-2007, 05:07 PM http://www.codeproject.com/useritems/AJAXUpload.asp and a look at that and get that to work to start with, and then move onto a the email part, which you can read more about here: http://www.sitepoint.com/article/advanced-email-php stuffradio 03-29-2007, 06:28 PM interesting articles... I'll read up on them a bit more and see what I can do :) I liked the PHP mail one because it showed me some things I didn't know how to do :p like the BCC part stuffradio 03-30-2007, 02:24 AM for the ajax thing... what format is asmx? There are files associated with the .NET IDE I have so.... gplhost 03-30-2007, 08:07 AM I believe (by reading the code and my knowledge) that this ajax example will work only with IE, unfortunatly. This is still a very good article. Thomas Ks Jeppe 03-30-2007, 08:10 AM I found the article buy doing a quick google search, no idea if it actually will work :) Else, have a go at googling yourself and you'll most likey find some stuff :D sasha 03-30-2007, 08:27 AM You cannot upload file using AJAX as there are browser limits to what it can access on the local system. If you need a way around this, you will have to use ActiveX in IE and/or make an extension for firefox. I believe I saw an extension for Gmail that was doing something like this, so you might want to look at that. gplhost 03-30-2007, 10:10 AM It's possible to do it with a Java applet though. I did one of them like that called "J'upload" (you can search on freshmeat if you want). The only "restriction" is that there is a warning message about the applet not being signed, as it's accessing local files. Thomas stuffradio 03-30-2007, 02:05 PM well I was wanting to have the files uploaded via php and just use ajax to run the script so I don't have to refresh the page... isn't that possible to do? horizon 03-30-2007, 07:15 PM I don't have to refresh the page... isn't that possible to do? Another known way if you do not wish to refresh the page, you can use IFRAMEs to switch pages once each files are being successfully uploaded to it's destination. stuffradio 04-01-2007, 07:19 PM aren't iframes unprofessional? horizon 04-01-2007, 07:30 PM True, but it is also the most efficient way to refresh a window without having to refresh a whole page for a single operation. ;) stuffradio 04-02-2007, 12:27 AM ok well the email page I'm setting up has 4 file input boxes for 4 files... and 4 buttons that say attach. How should I do this? Maybe, when they hit attach, it posts the file somewhere, and uploads it to the server, and disables that text box? If so... how would I go about keeping the value they entered in to the title and the message text box which I know will happen. Most people don't attach files until AFTER they enter the content. Jeremy 04-02-2007, 12:53 AM Check out http://roundcube.net/ for there code, its open source. stuffradio 04-02-2007, 01:06 AM but... it's only for sending emails, not receiving emails. So would looking through all that code really be beneficial? Burhan 04-02-2007, 02:53 AM ok well the email page I'm setting up has 4 file input boxes for 4 files... and 4 buttons that say attach. How should I do this? Maybe, when they hit attach, it posts the file somewhere, and uploads it to the server, and disables that text box? Why would you want to do that? If someone wants to change the file, what would they do? Refresh the page? If so... how would I go about keeping the value they entered in to the title and the message text box which I know will happen. Most people don't attach files until AFTER they enter the content. Right here you have answered your question, as by the time people reach the file upload box, they would have already filled out the form so there is not need to have two submits. One click and the form and the files will be posted to your script. Have you considered what would happen if someone uploaded four very large files? The page would seem to 'hang' as the javascript is 'posting' the files on your behalf. Maybe this is not the right problem to be solved with ajax ;) stuffradio 04-02-2007, 03:17 AM understood.... so you're saying just use normal PHP? Also trying to detect multiple values in one text box like VBulletin does for PM script. textbox: username1; username2; username3; any idea how to do that? gplhost 04-02-2007, 03:45 AM aren't iframes unprofessional? Why do you say so? To me, this type of sentence is a remaining of the dark age of IE 3 when it was badly supported. In 2007 there is no reason to say that anymore, especialy when we are talking about AJAX & Java / Javascript. Thomas Xeentech 04-02-2007, 04:00 AM My feeling is that if the iframe is added to the DOM in "detect ability" not "detect browser version" style javascript and remains hidden via something like display:none, then they're ok, and can get you around certain limitations in XMLHTTPRequest(). But other wise they are just UGLY. They don't scroll with the page, if you wheel up over them your page might scroll or might not depending on browser/flash etc.. You hit back and just the iframe goes back (gah!). No doubt screen reader type software handles iframes is some funky-*** fashion too. I duno how that would work.. read one page then read the iframe? Not cool. gplhost 04-02-2007, 06:37 AM To me it really depend on how and when you use the frames. In many cases, it's very conveinient. I wrote a full app (called Shuttleplan if you want to search on google) that was full of javascript, using multiple frames in the main screen (the planner of the app), and my customer was more than happy of it. There was no scroll issue like you said because the main page itself was made smaller than the screen, and the mouse wheel even and scrollings were catched by javascript. Also, sometimes, you do NOT want to have your iframe scrollable, and you know that it will fully appear in the screen. I don't think iframe are UGLY, I think SOME people use them an ugly way. Thomas |