Forum Moderators: open

Message Too Old, No Replies

$ File Array is Empty

javascript, asp, php, image, upload

         

confused noob

8:14 pm on Jul 3, 2008 (gmt 0)

10+ Year Member



I know this is a javascript forum, but I was told to ask my question here instead of the PHP forum. I believe those guys have taken me as far as they can. Now it seems as though this is a javascript problem.

Here is the code I am working with:

This is the js function within the asp page that calls the php page.

function updateImg(action, uID, param1)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var filename = document.form1.whatsit.value;//Image Name

alert (filename);
var url="test.php"
url=url+"?action="+action
url=url+"&username="+uID
url=url+"&param1="+param1
//url=url+"&param2="+param2
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)

}

when I run this script:
echo '<pre>'; print_r($_FILES); echo '</pre>';
exit;

this is what I get:

Array
(
)

Is this not possible? To go from Embedded JS in ASP to PHP.

DrDoc

10:40 pm on Jul 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



For security reasons it is not possible to submit files or file information via JavaScript.

torbol

6:29 am on Jul 4, 2008 (gmt 0)

10+ Year Member



confused noob, i mean you want to send file without page refresh. You can do it but you need use iframe solution. Read about it: [developer.yahoo.com...] . This is free open source library. This is one of most popular solutions in network.

Peace V

confused noob

12:48 am on Jul 8, 2008 (gmt 0)

10+ Year Member



Well, technically, I am not trying to submit or pass the file name via javascript. all the script does it display the loading gif and call a php page. the php page is not picking up the filename so my file is not getting downloaded to my server. Let me mention that the javascript is contained within an ASP page that calls the PHP page.

Thanks, CN