Jump to content
  • Advertisement
Sign in to follow this  

[web] dojo file upload problem

This topic is 4233 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I'm trying to get dojo file upload working, but for some reason when I send the AJAX request through dojo.io.bind, the target script isn't getting the <input type="file"> information. Here's the javascript:
function uploadPicture(form) {
     var bindArgs = {
		url: "cp_menu_upload_pic.php",
		method: "post",
		error: function(type,error) {
			//restore the form
                        //...code goes here....
			result.innerHTML = error;		
		load: function(type,data,event) {
			//restore the form
			//.....code goes here.......
			result.style.display = "block";
			if (t.indexOf("error") > -1) {
				//there's an error?
				result.innerHTML = data;
			} else {
				//we're given the filename so let's grab that
				dojo.byId("pic-filename").value = data;
				//generate some beautiful HTML
				var html = "";
				result.innerHTML = data;
		mimetype: "text/plain",
		formNode: form
	return false;
Yes, I did include dojo.require("dojo.io.IframeIO"); Here is the target script, cp_menu_upload_pic.php


pretty straightforward, I'm just trying to see what I get. Here is the form HTML:
			<form id="pic-upload-form" onsubmit="return uploadPicture(this);" method="post" enctype="multipart/form-data">
				<td colspan="4">
					<label for="pic-file">Upload Picture: </label>
					<input type="file" name="pic-file" id="pic-file" size="30" />
				<td colspan="3">
					<input type="submit" id="pic-upload" name="pic-upload" value="Upload"/>
				<td colspan="4">
					<div id="pic-upload-result" style="display:none">
<input type="hidden" id="pic-filename" name="pic-filename" value="" />
</td> </tr> I feel like I'm missing something important but browsing through the internet I can't seem to pinpoint the problem. Any ideas? Thanks in advance!

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!