Jump to content

cryptinitedemon

New Members
  • Posts

    5
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cryptinitedemon's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Okay, so I know how to do php uploads for files on the local server and such, but is it possible to have your PHP web site and apache on one machine and then have it actually upload the files to another? I'm planning on implementing a database program with file uploads, but I want all files to be stored on a separate storage machine.
  2. I can't get the response text element in the object to show any actual text. Basically the html calls jstablerender() when a button is click. Then XMLhttpRequest calls some file called dummyfile.php which echos out "Hello there sir". But for some reason it never displays in the alert message. Here's my code var xmlHttp; function jstablerender() { xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Browser does not support HTTP Request") return } var url="dummyfile.php"; xmlHttp.onreadystatechange= function() { if (xmlHttp.readyState==4) { alert(xmlHttp.responseText); } } xmlHttp.open("GET",url,true); xmlHttp.send(null); } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { //Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } And then the php file <?php echo "Hello there sir"; ?>
  3. Is there anyway that I can take the output of echo and put it in a string variable? The reason I ask is because I'm using some stupid pre-built web program and it will echo out the variable value just fine. But internally to get this variable there are some 20-something different functions that return this value up a hierarchy. And whenever I pass this variable to anything to compare it to some string, it can't do crap with it. I really don't have the time to search through all these nested calls to see how the programmer formatted it.
  4. That won't help me any. The point is that I want to take the output of my php uploading script and put it in the page I already have open. So when they click the submit button, a little red text comes up below it saying "your file was uploaded." However, to do this I have to use XMLHTTP request, which has that "send" function in it that allows you to define your post data. And that's the part that confuses me because I have no idea how to define the variables in this function's parameters for a file upload. I know how to do it for regular text fields and radio buttons because all the info in those fields are just simple text strings, but php uses that global _FILES variable to suck out the info it needs to upload the file to a server. In other words, I'm looking how to format a file upload request using XMLHTTPRequest's commands instead of using the form action="somefile.php", which does everything automatically for me.
  5. Okay, I've been able to get the php upload working just fine. I have a form whose action goes to somepage.php and it uploads and spits out the new page and everything. What I'm looking to do is instead of displaying the somepage.php, I want to use AJAX and call a function in javasript on the page that will use some php file to upload and then send back a message about whether or not it was successful. The form action would be left blank. that message would be put in the page, without leaving the page because I'll have other ajax messages on the page. Soooo, what gets me is that everyone says that enctype="multipart/form-data" field is important to the file uploads. If I leave the action field blank, and then let the submit call my javascript function, would that even be possible to do, or am I required use use a form acion for this? I know what I'm saying might seem weird with how I'm wording it, but hopefully you guys will get what I'm saying. I just have a page that will be getting lots of these little status messages about different changes and I don't want it to have to go to another page.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.