Skip to main content

Posts

Showing posts with the label file-upload

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-da

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

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. Is it possible? Thanks for the help :)

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.

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: //Directory where files are stored if ($grade == '9') { $target = "storage/g9/"; } elseif ($grade == '10') { $target = "storage/g10/"; } elseif ($grade == '11') { $target = "storage/g11/"; } elseif ($grade == '12') { $target = "storage/g12/"; } $target = $target . $_POST['snumber'] . "." . $extension; move_uploaded_file($_FILES['upload']['tmp_name'], $target); Now, with an AJAX based file uploader it starts uploading before you even hit submit so PHP doesn't get a chance to pickup the input fields to decide what the upload path is going to be, it can only go to a predefined one. To see how the AJAX file uploader does

Image upload takes previous temp file to upload in php

Here i have the problem with uploading image in php. The problem is that when first time i upload the image file it works fine. But when i am trying to upload the file second time without page refresh it takes first image name and upload it. Anybody can tell me what the problem and how can it resolve ? $name = $_FILES['ImageFile']['name']; $size = $_FILES['ImageFile']['size']; $tmp = $_FILES['ImageFile']['tmp_name']; $path = "public/www/uploads/"; $valid_formats = array("jpg", "png", "gif", "bmp"); $response = ''; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { if($size<(1024*1024)) { $actual_image_name = time().substr(str_replace(" ", "_", $txt), 5).".".$ext; if(move_uploaded_file($t

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. I've also tried swfupload, but it's less polished and seems less active than fancyupload. Are there newer tools that provide similar functionality? Any recommendations?