To start off, I have the tendancy to sound confusing when i explain things. Please feel free to query about anything you might not understand!
Please request code you would like to see, besides the two examples below there is ALOT of code and dont want to clutter the first post too much.
I have a html form with the usual "name" "number" etc fields, but it also has a "file" input field. When submit is pressed the form moves to a php script (seperate file). The form beginning looks like:
[!--html--][div class=\'htmltop\']HTML[/div][div class=\'htmlmain\'][!--html1--]<form id="attach_form" action="phpScriptFile.php" method="post">
<input type="file" id="filenames">
The script then uploads the specified file via php's ftp functions to the server and then adds it to a generated email as an attachment. Then sends the email to firstname.lastname@example.org
With the above structure it works. Everything uploads and sends correctly. BUT now i have been adding Ajax features to my website, to avoid jumping to pages and have things refresh/reloaded all the time. You know, make it look cool! And this is where my problem comes into play.
When i add the Ajax features i make so that the form no longer goes directly to the php script/file. Now it goes through a few JS functions before it gets to the php file. First some validation and then the ajax call.
Before the ajax i was using $_FILES array in php to access the data i needed from the file input field to upload via ftp. Examples of these values/data:
Nothing had to be brought in via $_POST['..'] for the file data, just used $_FILES.
$_FILES as i understand it is a reference to the temp location on the server, of the file made by the file input field in the html. I also read that if one does not use the temp data of the file immediately, it goes away. "POOF! All Gone!"
So now when i use the ajax(JS), by the time the code gets to the php script the $_FILES array is empty!
My question is basically:
Is there a way that i can keep the "file" data alive in JS that i can run through the JS functions and still access the temp data via $_FILES array in the php file? Or even if there might be a different way to access the info which i need after the whole JS traversal?
Thank you upfront!
P.S: What do i use to show php code? As seen above