473,756 Members | 9,668 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

AJAX file upload problem

Hello,
I found a script here: http://www.webtoolkit.info/ajax-file-upload.html
which supposedly allows you to upload files using AJAX (I'm not an
expert). The site claims it's the best way to upload files out there,
and the file size is only 1 kb.

I couldn't get it to work for me. I downloaded the files to my
computer, and opened the index file with my browser. It doesn't work
(the demo on their site does); IE doesn't show any error messages or
anything, and FF shows a single word that might be treated as an error
notifier: 'undefined'. Does this thing even work? If it does, could
anyone please give me detailed steps on how to using it on my site?
dzn

Jun 27 '07 #1
3 3928
On Jun 28, 12:12 am, dreamznatcher <tashfeenmah... @gmail.comwrote :
Hello,
I found a script here:http://www.webtoolkit.info/ajax-file-upload.html
which supposedly allows you to upload files using AJAX (I'm not an
expert). The site claims it's the best way to upload files out there,
and the file size is only 1 kb.

I couldn't get it to work for me. I downloaded the files to my
computer, and opened the index file with my browser. It doesn't work
(the demo on their site does); IE doesn't show any error messages or
anything, and FF shows a single word that might be treated as an error
notifier: 'undefined'. Does this thing even work? If it does, could
anyone please give me detailed steps on how to using it on my site?
dzn
it just posts to a hidden iframe. and grabs the body reponse from the
script in the iframe, returning it to the parent frame as "what file
you just sent me"

this is easy to do with no javascript

<form action="post" target="iframe" action="upload_ script.php"
enctype="multip art/form-data"
>
<input name="file" type="file" />
<input name="submit" type="submit" value="doit" />
</form>
<iframe src="" name="iframe"></iframe>

now create upload_script.p hp
<?php print_r( $_FILES ); ?>

and press submit, you will see the details of the file uploaded. It
would be upl to you to stick more logic in the upload_scipr.ph p but
you get the basic idea, all this site does it have javascript inject
the iframe and a bit other stuff, "unobtrusiv ely"

Now you /ca/ upload using pure XHR, but it requires you to set some
custom (and insecure) security settings for firefox, and wont work on
IE, so for now, stick to hidden iframes.

There is a problem with receiving real times messages back from an
uploading file in the iframe, so you might think - oooo - I can have
message coming back to me from that iframe telling me how far along
its got, and so on... Once you actually start uploading properly
instead of reporting what the upload /would/ have been - things et
trickier and although there are some "real time reporting" iframe
upload scripts around they tend to be a bit hit and miss, making
assumptions about temporary files and so on, and lacking multiple
uploaders support.
Jun 28 '07 #2
dreamznatcher wrote:
Hello,
I found a script here: http://www.webtoolkit.info/ajax-file-upload.html
which supposedly allows you to upload files using AJAX (I'm not an
expert). The site claims it's the best way to upload files out there,
and the file size is only 1 kb.

I couldn't get it to work for me. I downloaded the files to my
computer, and opened the index file with my browser. It doesn't work
(the demo on their site does); IE doesn't show any error messages or
anything, and FF shows a single word that might be treated as an error
notifier: 'undefined'. Does this thing even work? If it does, could
anyone please give me detailed steps on how to using it on my site?
Did you put an appropriately named PHP file in that same directory?

<pre>
<?php
print_r($_POST['form']);
?>
</pre>

Should work nicely. *BUT!*

This is the crappiest solution I have ever seen. Firstly, it does not
upload your file. It merely displays the filename that was selected.

You would need to write an entire file handling script (in PHP for
example), to handle your uploads. Hell, the FORM isn't even set up
correctly to handle file submissions.

In fact, I am also a bit perplexed why it loads the contents of the
response into a hidden IFRAME.

Anyway, check out: www.ajaxtoolbox.com for a much nicer, simpler
solution and then check any one of thousands of file upload scripts in
PHP (if that is your desired language).

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Jun 28 '07 #3
On Jun 28, 8:44 am, -Lost <maventheextraw o...@techie.com wrote:
dreamznatcher wrote:
Hello,
I found a script here:http://www.webtoolkit.info/ajax-file-upload.html
which supposedly allows you to upload files using AJAX (I'm not an
expert). The site claims it's the best way to upload files out there,
and the file size is only 1 kb.
I couldn't get it to work for me. I downloaded the files to my
computer, and opened the index file with my browser. It doesn't work
(the demo on their site does); IE doesn't show any error messages or
anything, and FF shows a single word that might be treated as an error
notifier: 'undefined'. Does this thing even work? If it does, could
anyone please give me detailed steps on how to using it on my site?

Did you put an appropriately named PHP file in that same directory?

<pre>
<?php
print_r($_POST['form']);
?>
</pre>

Should work nicely. *BUT!*

This is the crappiest solution I have ever seen. Firstly, it does not
upload your file. It merely displays the filename that was selected.

You would need to write an entire file handling script (in PHP for
example), to handle your uploads. Hell, the FORM isn't even set up
correctly to handle file submissions.

In fact, I am also a bit perplexed why it loads the contents of the
response into a hidden IFRAME.

Anyway, check out:www.ajaxtoolbox.comfor a much nicer, simpler
solution and then check any one of thousands of file upload scripts in
PHP (if that is your desired language).

--
-Lost
Remove the extra words to reply by e-mail. Don't e-mail me. I am
kidding. No I am not.
Thanks for responding. I kinda get the idea.. Thanks again.
dzn

Jun 28 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
7800
by: JMB | last post by:
Hello, I was wondering if anyone knew of any projects extending the inline upload progress bar to utilize an inpage image uploader with bar, without having to refresh or go to a seperate page, nor opening a second box for display of the progress bar. I had been using the MegaUpload that was adapted from Raditha's script at http://www.raditha.com/upload.php . The MegaUpload script I have been using takes the progress bar inpage,...
3
19882
by: markus.rietzler | last post by:
i want to do (multiple) file upload(s) and display a progress bar. with firefox and safari it is no problem at all. only IE makes some problems. my script is based on ajax-uploader, which can be found at www.srmiles.com/freestuff/ajax_file_uploader/ . you can do multiple file uploads. each upload will have it's own "form"-tag, so that each file is uploaded for its own. could be a good solution if there are "big" uploads.
0
2315
by: wasif | last post by:
I am trying to upload file using ajax and php but having some problems. it always says that there was a problem and file is not uploaded. here is the code form and ajax code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Untitled...
3
3271
by: Ken1 | last post by:
Hello, Does anyone know of an easy to implement ajax upload script for php which also has a progress bar. If possible I'd like it to be able to remove already uploaded files and do minor manipulations... Thanks.
1
2891
by: bsprogs | last post by:
I am currnetly programming a file hosting website in PHP and I am slowly integrating AJAX into the website. Here is my problem: The user uploads the file. The server processes the file and stores a $_SESSION variable. After the upload is complete, the server supplies a link that allows the user to view their link codes. Once they click the link, the page will return the information stored in the $_SESSION variable. The normal link which...
3
4512
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need my objective is this that when i uplod a file it should be desply on same page with ajax uplod after when i refresh page this should be not remains longer and on clicking other image its replase previous image plz help how i can do this the...
1
3953
by: kksandeep | last post by:
i am using this three files to uplod file. i got this file from net but i think these have some error. i am new to this field plz help the script i found is some helpful but not too that i need my objective is this that when i uplod a file it should be desply on same page with ajax uplod after when i refresh page this should be not remains longer and on clicking other image its replase previous image plz help how i can do this the...
1
2039
by: gamernaveen | last post by:
Hey guys , am just getting into the AJAX scene and am a noob. I am really worried about Ajax upload , cant figure it out. I have a basic html form , like this <form action="upload.php" method="POST" ENCTYPE="multipart/form-data"> *<input type="text" name="name" value="Nick/Name"/><br/><input type="password" name="pass" value="password"/><br/> <textarea rows="5" cols="15" value="comments" name="comments"/><br/><input type="file"...
11
8410
by: kj | last post by:
I would like to convert a form that currently uses the traditional CGI sequence (i.e. the action associated with the form sends a POST request to a server-side CGI script) to one that uses AJAX to send a JSON-encoded request to a remote web service. The stumbling block I'm running into is that one of the inputs in the form is a file upload element, and I can't figure out how to include the data from the specified file in the JSON...
0
9303
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9894
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9679
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9541
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8542
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4955
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3651
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.