Showing posts with label file-upload. Show all posts
Showing posts with label file-upload. Show all posts

Sunday, May 27, 2012

Storing PHP(/PHP-FPM/Apache)"s temporary-from-upload files in RAM rather than the filesystem (or encrypted only)?


Thread overview



I can unfortunately only accept one answer - but to anyone reading this, the entire thread is extremely valuable and contains the collective insights of many people. Depending on what you are hoping to achieve, the accepted answer may not be interesting to you . If you've come here through a search engine, please take a moment to read the whole thread .

Tuesday, May 8, 2012

How do I upload files using http/ftp to iphone/ipad? (Eg. ifile, goodreader)


Is there any good advice on uploading files to the device? I've seen many apps create a http server on 80 or 8080 to upload files. Does that mean I have to implement a server too?

Sunday, April 8, 2012

problem in file upload



I have the following markup:







<select multiple="multiple" id="targetFilesList" style="width:200px;height:110px;">

</select>

<input type="button" value="Get" id="btnGet" />







and following javascript:







$(function()

{

$('#btnGet').click(function()

{

var fileupload = $("<input type='file' name='filetoupload' style='visibility:hidden;'/>");

$('body').append(fileupload);



fileupload[0].onchange = function()

{

$('#targetFilesList').append('<option >' + fileupload.val() + '</option>');

return false;

}

fileupload.click();

});

});







Scenario is that i have to upload multiple files and once user has chosen the file to be uploaded i have to show the file name to user.Then,on submitting the form i will upload all the files.For this,on clicking the get button i am adding a fileupload control dynamically and initialise onchange event of the fileupload control just added. The problem in chrome 12 on clicking get button fileupload control does not get opened but in firefox4 and ie8 it is working. Any idea why?



Source: Tips4all

Is it possible to upload file via $.ajax(options) or xhr.send(file) only?



I'm using file api and xhr2 spec. I created an uploader (backed by flash for older browsers) that was using FormData and $.ajax(options) where the FormData object with File was part of options.data object. Everything was working.





Now I decided to remove FormData because of weak browser support. And I can't figure a way to upload the file other than







var xhr = new XMLHttpRequest();

xhr.setRequestHeader("Cache-Control", "no-cache");

xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");

xhr.setRequestHeader("X-File-Name", file.name);

xhr.send(file);







Which doesn't return Promise that I can use in the recursion function.





My code is like this :







startUpload: function() {

var that = this;

that.recurseSend(that.queue);

},



_initProgressListener: function (options, file) {

var that = this;

var xhr = $.ajaxSettings.xhr();

options.contentType = 'multipart/form-data';

options.processData = false;

options.type = 'POST';

// WHAT TO DO HERE TO avoid FormData???? What ever I put into options.data - fails



/* THIS WOULD WORK

var formData = new FormData();

formData.append('file', file);

options.data = formData;

*/



if (xhr.upload && xhr.upload.addEventListener) {

xhr.upload.addEventListener('progress', function (e) {

that._onProgress(e, file);

}, false);

options.xhr = function () {

return xhr;

};

}

},



recurseSend: function (queue) {

var file = queue.pop();

if(file != undefined) {

var that = this;

var options = that.options;

that._initProgressListener(options, file);



var send = function() {

jqXHR = ($.ajax(options)).done(function(result, textStatus, jqXHR) {

that._onDone(result, textStatus, jqXHR, file);

queue.stats['successful_uploads']++;

}).fail(function(jqXHR, textStatus, errorThrown) {

that._onFail(jqXHR, textStatus, errorThrown, file);

queue.stats['upload_errors']++;

}).always(function(result, textStatus, jqXHR) {

that._onAlways(result, textStatus, jqXHR, file);

queue.stats['files_queued']--;

that.recurseSend(queue);

});

return jqXHR;

};



this._beforeSend(file);

return send();

}

},







To make it short, $.ajax(options) resolves into xhr.send(formData) if options.data = FormData but how do I make it resolve into xhr.send(file) ?





EDITED: I was playing with it and if I set options.data = file; then $.ajax(options) executes xhr.send(theFile); but with error Error: INVALID_STATE_ERR: DOM Exception 11





and the request is sent as POST multipart/form-data request, but without the multipart body with file in it





And if I put it into options.data = {file: file}; it is serialized no matter if processData property is set to true or not.



Source: Tips4all

Tuesday, February 21, 2012

Writing data from my app to csv & upload it?


I wondered if it's possible to write some data to csv file in the documents path, or other convenient readable file. For example - i have a few text fields that i want the user to fill & then i want him to click "send" & after that the information will be written on a file that i could easily read & upload to my server. In my case i have an app that i want people to register for my members club, with first name, last name & phone number & i want to take this information & read it easily after is uploaded to my server. For testing i'm using my dropbox account as a server.

Monday, February 20, 2012

How to place an "inline image&rdquo; in form before upload?


I want to allow users to write a post and upload images inline through out it (like a CMS blog post). Writing the file upload script is easy. But allowing a "place inline" button / functionality is proving to be tricky. Is there a tutorial on how to do this? I'm messing around with some javascript to allow it. Also, I'm not sure if I should display the inline tmp image or actually upload the file (with a separate upload button than the full form upload button) and show the actual image loc before the form is submitted? I'm all over the place on this right now. How should I go about this? Thank you.

Sunday, January 29, 2012

How do you dynamically set the upload target path when using an AJAX based file uploader?


I'm trying to implement Valum's file uploader (improved by Ben Colon https://github.com/bencolon/file-uploader ) and I'm running into a problem. Previously, my upload.php had the upload target set in accordance to certain input fields. See here:

Wednesday, January 11, 2012

Newer alternative or newer version of Fancyupload?


I'm in need of a mootools upload widget. It seems that Fancyupload is still at the top of most recommendations and searches for this category. However, the project appears to have been left untouched for at least a few years, and it seems to be non-functional in IE9, and is optimized for mootools 1.2.