Search Results

Search found 386 results on 16 pages for 'fileupload'.

Page 6/16 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • Using respond_to ... format.json and jQuery Form Plugin by malsup

    - by Topher Fangio
    Hello all, I'm having a tad bit of trouble getting the jQuery Form Plugin to work properly with a file-upload field. When I use the plugin to submit the form without a file-upload field, the format.json portion of the respond_to do |format| block is called properly. However, by adding the file-upload field, it only executes the format.html portion which makes my javascript code think that an error has occurred. Has anyone run into this before or know a way to force the plugin to always use json? Alternatively, can I modify the url that the plugin uses to force Rails to render the json? Thanks very much for any help! Code below: # app/controllers/details_controller.rb def create @detail = Detail.new(params[:detail]) style = params[:detail_style].to_sym || :thumb data = { :id => '5', :url => 'test.rails' } respond_to do |format| if @detail.save flash[:notice] = 'Your image has been saved.' data = { :id => @detail.id, :url => @detail.data.url(style) } format.html { redirect_to :action => 'index' } format.json { render :json => "<textarea>#{data.to_json}</textarea>", :status => :created } else format.html { render :action => 'new' } format.json { render :json => @detail.errors, :status => :unprocessable_entity } end end end /* app/views/sidebar/_details.html.erb (excerpt) */ <% form_for(Detail.new, :html => { :multipart => true } ) do |f| %> <%= hidden_field_tag 'detail_style', 'thumb' %> <%= f.label :image, "Recent Images" %> <%= f.file_field :image%> <p> <%= f.submit "Upload" %> </p> <% end %> <script> $(document).ready(function() { var options = { dataType: 'json', success: function(json, statusText) { console.log("success: " + json); }, error: function(xhr, statusText, errorThrown) { console.log("error: " + xhr.responseText); } }; $('#new_detail').ajaxForm(options); });

    Read the article

  • HTTP vs FTP upload

    - by Richard Knop
    I am building a large website where members will be allowed to upload content (images, videos) up to 20MB of size (maybe a little less like 15MB, we haven't settled on a final upload limit yet but it will be somewhere between 10-25MB). My question is, should I go with HTTP or FTP upload in this case. Bear in mind that 80-90% of uploads will be smaller size like cca 1-3MB but from time to time some members will also want to upload large files (10MB+). Is HTTP uploading reliable enough for such large files or should I go with FTP? Is there a noticeable speed difference between HTTP and FTP while uploading files? I am asking because I'm using Zend Framework which already has HTTP adapter for file uploads, in case I choose FTP I would have to write my own adapter for it. Thanks!

    Read the article

  • TinyMCE image upload & insert without a gallery

    - by Fungsten
    I've been searching for a plugin of TinyMCE that allows to upload and insert an image in the text, the problem I've found with many plugins is allowing to see and select from a gallery of images of the server, that's a functionality I don't need or want, just allow the user to select an image from his computer, upload and insert it. There is a plugin that acomplishes only this? Thanks

    Read the article

  • upload file with FTP using nant

    - by Or A
    hi, i have a nant script that i use to build my .net project and i'm looking to see if there is a way to upload the resulted assemblies to some remote folder using an FTP task of nant. i couldn't find any good example online, and i'm wonder if anyone know how to do it, if its doable at all. FYI: i'm running it on a windows machine, if it makes any difference. Thanks, Ori

    Read the article

  • c# uploading file - error

    - by user228058
    I have a webpage where the user can upload an excel file. I'm trying 2 different files - one works without a problem, and the other one gives me this error: Error: Length cannot be less than zero. Parameter name: length I know that sometimes this occurs when the file size is zero, but that is not the case here. Can anyon shed light on this issue? Please let me know if you need more info.

    Read the article

  • getting the request.files count as 0 in mvc???????

    - by Ritz
    hello all, please help me when i am uploading a particu;ar file in mvc and i am requesting the file using request.files in the controller i am getting the count as 0 please tell me where i am missing.i am using asp.net + mvc. i have used a simple file upload control of html. please help me,its urgent Thanks Ritz

    Read the article

  • ASP.net MVC - Determine how many bytes of a request have been read/received?

    - by vdhant
    Hey guys Just wondering if anyone has any idea how you can determine how many bytes of a request have been read/received by the server... In other words how do I stream http request... In that, users are uploading files and I want to report on a perotic basis how many bytes have been read/received so far. Just wondering if anyone has any ideas on how I might do this... Cheers Anthony

    Read the article

  • What design considerations should one take to receive text and multiple attachments via web?

    - by ramesh.nagul
    I am developing a web application to accept a bunch of text and attachments (1 or more) via email, web and other methods. I am planning to build a single interface, mostly a web service to accept this content. What design considerations should I make? I am building the app using ASP.NET MVC 2. Should the attachments be saved to disk or in the database? Should the unified single interface be a web service? Pros and cons to using web services to upload files

    Read the article

  • php upload file function

    - by Jacksta
    I am trying to write a script which uploads a file via a html form. When I click submit nothing happens. file: upload_form.html <!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=utf-8" /> <title>Untitled Document</title> </head> <body> <form action="do_upload.php" method="post" enctype="multipart/form-data"></form> <p><strong>File to upload</strong></p> <p><input name="img1" type="file" size="30" /></p> <p><input name="submit" type="submit" value="Upolad File" /></p> </body> </html> file: do_upload.php <?php if ($_FILES[img1] != "" { @copy($_FILES[img1] [tm_name], "/tmp" .$_FILES[img1][name]) or die("couldnt copy the file"); } else { die("no file specified"); } ?> <HTML> <head> <title>Successfull File Upload</title> </head> <body> <h1>Success</h1> <p>You sent: <? echo $_FILES[img1][name]; ?>, a <? echo $_FILES[img1][size]; ?>byte filw with a mime type of <? echo $_FILES[img1][type]; ?></p> </body> </HTML>

    Read the article

  • How to upload multiple files to a SharePoint List

    - by AboutDev
    I am trying to upload multiple files into a SharePoint LIST as attachments. (can't use Document Libraries). I'm trying to use jquery to accomplish this but I'd appreciate any help or advise you may have concerning how best to upload to a list. For instance, can multi-uploads be accomplished when creating a new item? If you have code or examples/url's I can refer to I would welcome that. Cheers. PS - I need to select multiple files to upload at one go too...I know you can do this with flash-uploaders but can this be done for ASP.NET and specifically for SharePoint?

    Read the article

  • How to get the file name for <input type="file" in jsp

    - by deepthinker121
    I want to read the file path from html input type="file" (the entry selected in the file dialog by the user) <script> function OpenFileDialog(form) { var a = document.getElementById("inputfile").click(); SampleForm.filePath.value = //set the path here document.SampleForm.submit(); } </script> <form name="SampleForm" action="TestServlet" method="get"> <input type="file" style="display:none;" id="inputfile"/> <a href="javascript:OpenFileDialog(this.form);">Open here</a> <input type="hidden" name="filePath" value=""/> </form> I want the path of the selected file to be read in my Servlet class How do I get the file path? Can I read it from var a? Or is there any way to directly access the file path from the input type="file" from my servlet?

    Read the article

  • Best way to store and deliver files on a CMS

    - by Tio
    Hi all.. First of all, this isn't another question about storing images on DB vs file system. I'm already storing the images on the file system. I'm just struggling to find a better way to show them to all my users. I' currently using this system. I generate a random filename using md5(uniqueid()), the problem that I'm facing, is that the image is then presented with a link like this: <img src="/_Media/0027a0af636c57b75472b224d432c09c.jpg" /> As you can see this isn't the prettiest way to show a image ( or a file ), and the name doesn't say anything about the image. I've been working with a CMS system at work, that stores all uploaded files on a single table, to access that image it uses something like this: <img src="../getattachment/94173104-e03c-499b-b41c-b25ae05a8ee1/Menu-1/Escritorios.aspx?width=175&height=175" /> As you can see the path to the image, now has a meaning compared to the other one, the problem is that this put's a big strain in the DB, for example, in the last site I made, I have an area that has around 60 images, to show the 60 images, I would have to do at least 60 individual query's to the database, besides the other query's to retrieve the various content on the page. I think you understand my dilemma, has anyone gone trough this problem, that can give me some pointers on how to solve this? Thanks..

    Read the article

  • PHP photo gallery with multiple upload form

    - by NightMICU
    Hi everyone, I am trying to develop a PHP driven gallery with a form that has at least four file upload boxes, each with its own title and caption. I have been using php.upload.class to process uploaded photos but not sure how I would go about handling each individual upload while preserving its details (title, caption). Is there a practical way to do this or should I instead upload just the photos and then have the user add titles and captions on the next page? Any help/suggestion would be greatly appreciated. Thanks!

    Read the article

  • Is there a simple way to make lists behave as files (with ftplib)

    - by Brent.Longborough
    I'd like to use ftplib to upload program-generated data as lists. The nearest method I can see for doing this is ftp.storlines, but this requires a file object with a readlines() method. Obviously I could create a file, but this seems like overkill as the data isn't persistent. Is there anything that could do this?: session = ftp.new(...) upload = convertListToFileObject(mylist) session.storlines("STOR SOMETHING",upload) session.quit

    Read the article

  • C# Uploading files to file server

    - by JustFoo
    Hello All, Currently I have an application that receives an uploaded file from my web application. I now need to transfer that file to a file server which happens to be located on the same network (however this might not always be the case). I was attempting to use the webclient class in C# .NET. string filePath = "C:\\test\\564.flv"; try { WebClient client = new WebClient(); NetworkCredential nc = new NetworkCredential(uName, password); Uri addy = new Uri("\\\\192.168.1.28\\Files\\test.flv"); client.Credentials = nc; byte[] arrReturn = client.UploadFile(addy, filePath); Console.WriteLine(arrReturn.ToString()); } catch (Exception ex) { Console.WriteLine(ex.Message); } The machine located at 192.168.1.28 is a file server and has a share c:\Files. As of right now I am receiving an error of Login failed bad user name or password, but I can open explorer and type in that path login successfully. I can also login using remote desktop, so I know the user account works. Any ideas on this error? Is it possible to transfer a file directly like that? With the webclient class or maybe some other class? Thanks

    Read the article

  • Unable to upload files through File Upload control

    - by Shrewd Demon
    hi, i am trying to upload files through the ASP.NET File Upload control. Every thing is working fine, except for the fact that when i try to upload the file on the server i am getting an error: (probably some authorization exception). do i need to give some rights to the upload up there on the server. If so then for which account and do i need to restart the server after giving rights?? Please help... thank you

    Read the article

  • How and where to store user uploaded files in high traffic web farm scenario website?

    - by Inam Jameel
    i am working on a website which deploy on web farms to serve high traffic. where should i store user uploaded files? is it wise to store uploaded files in the file system of the same website and synchronize these files in all web servers(web farm)? or should i use another server to store all uploaded files in this server to store files in a central location? if separate file server will be a better choice, than how can i pass files from web server to that file server efficiently? or should i upload files directly to that file server?

    Read the article

  • file upload in existing site with jquery and codeigniter

    - by Sam
    I am a new bee to ajax world. I am working on a site which uses jquery and codeigniter which processes big files like 2GB. It basically parses file and stores some extracted data from it, it uses ajax to show how far the files have been processed etc. Now I want to change the way we process files. I want to first store the file on server side and then start the processing. I evaluated upload class of codeigniter but looks like I cannot use it for this purpose as this class works with field_name and I could not find a way to make an ajax call to the upload class. My questions is : What would be suitable for my problem? Thanks in advance, Sam

    Read the article

  • plupload variable upload path?

    - by SoulieBaby
    Hi all, I'm using plupload to upload files to my server (http://www.plupload.com/index.php), however I wanted to know if there was any way of making the upload path variable. Basically I need to select the upload path folder first, then choose the files using plupload and then upload to the initially selected folder. I've tried a few different ways but I can't seem to pass along the variable folder path to the upload.php file. I'm using the flash version of plupload. If someone could help me out, that would be fantastic!! :) Here's my plupload jquery: jQuery.noConflict(); jQuery(document).ready(function() { jQuery("#flash_uploader").pluploadQueue({ // General settings runtimes: 'flash', url: '/assets/upload/upload.php', max_file_size: '10mb', chunk_size: '1mb', unique_names: false, // Resize images on clientside if we can resize: {width: 500, height: 350, quality: 100}, // Flash settings flash_swf_url: '/assets/upload/flash/plupload.flash.swf' }); }); And here's the upload.php file: <?php /** * upload.php * * Copyright 2009, Moxiecode Systems AB * Released under GPL License. * * License: http://www.plupload.com/license * Contributing: http://www.plupload.com/contributing */ // HTTP headers for no cache etc header('Content-type: text/plain; charset=UTF-8'); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); header("Cache-Control: no-store, no-cache, must-revalidate"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); // Settings $targetDir = $_SERVER['DOCUMENT_ROOT']."/tmp/uploads"; //temp directory <- need these to be variable $finalDir = $_SERVER['DOCUMENT_ROOT']."/tmp/uploads2"; //final directory <- need these to be variable $cleanupTargetDir = true; // Remove old files $maxFileAge = 60 * 60; // Temp file age in seconds // 5 minutes execution time @set_time_limit(5 * 60); // usleep(5000); // Get parameters $chunk = isset($_REQUEST["chunk"]) ? $_REQUEST["chunk"] : 0; $chunks = isset($_REQUEST["chunks"]) ? $_REQUEST["chunks"] : 0; $fileName = isset($_REQUEST["name"]) ? $_REQUEST["name"] : ''; // Clean the fileName for security reasons $fileName = preg_replace('/[^\w\._]+/', '', $fileName); // Create target dir if (!file_exists($targetDir)) @mkdir($targetDir); // Remove old temp files if (is_dir($targetDir) && ($dir = opendir($targetDir))) { while (($file = readdir($dir)) !== false) { $filePath = $targetDir . DIRECTORY_SEPARATOR . $file; // Remove temp files if they are older than the max age if (preg_match('/\\.tmp$/', $file) && (filemtime($filePath) < time() - $maxFileAge)) @unlink($filePath); } closedir($dir); } else die('{"jsonrpc" : "2.0", "error" : {"code": 100, "message": "Failed to open temp directory."}, "id" : "id"}'); // Look for the content type header if (isset($_SERVER["HTTP_CONTENT_TYPE"])) $contentType = $_SERVER["HTTP_CONTENT_TYPE"]; if (isset($_SERVER["CONTENT_TYPE"])) $contentType = $_SERVER["CONTENT_TYPE"]; if (strpos($contentType, "multipart") !== false) { if (isset($_FILES['file']['tmp_name']) && is_uploaded_file($_FILES['file']['tmp_name'])) { // Open temp file $out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab"); if ($out) { // Read binary input stream and append it to temp file $in = fopen($_FILES['file']['tmp_name'], "rb"); if ($in) { while ($buff = fread($in, 4096)) fwrite($out, $buff); } else die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}'); fclose($out); unlink($_FILES['file']['tmp_name']); } else die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}'); } else die('{"jsonrpc" : "2.0", "error" : {"code": 103, "message": "Failed to move uploaded file."}, "id" : "id"}'); } else { // Open temp file $out = fopen($targetDir . DIRECTORY_SEPARATOR . $fileName, $chunk == 0 ? "wb" : "ab"); if ($out) { // Read binary input stream and append it to temp file $in = fopen("php://input", "rb"); if ($in) { while ($buff = fread($in, 4096)){ fwrite($out, $buff); } } else die('{"jsonrpc" : "2.0", "error" : {"code": 101, "message": "Failed to open input stream."}, "id" : "id"}'); fclose($out); } else die('{"jsonrpc" : "2.0", "error" : {"code": 102, "message": "Failed to open output stream."}, "id" : "id"}'); } //Moves the file from $targetDir to $finalDir after receiving the final chunk if($chunk == ($chunks-1)){ rename($targetDir . DIRECTORY_SEPARATOR . $fileName, $finalDir . DIRECTORY_SEPARATOR . $fileName); } // Return JSON-RPC response die('{"jsonrpc" : "2.0", "result" : null, "id" : "id"}'); ?>

    Read the article

  • Attachment_fu file saving problem

    - by Anand
    Attachment_fu plugin is kind of old, but I have to modify an old app and I can't use another plugin like paperclip etc. So here's the code without further ado Submissions table structure --------------------------- | content_type | varchar(255) | YES | | NULL | filename | varchar(255) | YES | | NULL app/models/submission.rb ------------------------ has_attachment :storage => :file_system, :path_prefix => 'public/submissions', :max_size => 2.megabytes, :content_type => ['application/pdf', 'application/msword', 'text/plain'] app/models/user.rb ------------------ has_one :submission, :dependent => :destroy app/views/user/some_action.html.erb ----------------------------------- <% form_for :user, :url => { :action => "some_action" }, :html => {:multipart => true} do |f| %> .... <%= file_field_tag "submission[uploaded_data]" %> <%end%> app/controllers/user_controller.rb ---------------------------------- @user = User.find_user(session[:user_id]) @submission = @user.submission if request.post? @submission.uploaded_data = params[:submission][:uploaded_data] end When the form is submitted, the database fields "content_type" and "filename" get updated and display the correct values, but the file does not appear in public/submissions/ directory. I have checked the permissions on the submissions directory. What am I missing? Many Thanks

    Read the article

  • File Upload drops with no reason

    - by sufoid
    Hallo I want to make an file upload. The script should take the image, resize it and upload it. But it seems that there is any unknown to me error in the upload. Here the code define ("MAX_SIZE","2000"); // maximum size for uploaded images define ("WIDTH","107"); // width of thumbnail define ("HEIGHT","107"); // alternative height of thumbnail (portrait 107x80) define ("WIDTH2","600"); // width of (compressed) photo define ("HEIGHT2","600"); // alternative height of (compressed) photo (portrait 600x450) if (isset($_POST['Submit'])) { // iterate thorugh all upload fields foreach ($_FILES as $key => $value) { //read name of user-file $image = $_FILES[$key]['name']; // if it is not empty if ($image) { $filename = stripslashes($_FILES[$key]['name']); // get original name of file from clients machine $extension = getExtension($filename); // get extension of file in lower case format $extension = strtolower($extension); // if extension not known, output error // otherwise continue if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif")) { echo '<div class="failure">Fehler bei Datei '. $_FILES[$key]['name'] .': Unbekannter Dateityp: Es können nur Dateien vom Typ .gif, .jpg oder .png hochgeladen werden.</div>'; } else { // get size of image in bytes // $_FILES[\'image\'][\'tmp_name\'] >> temporary filename of file in which the uploaded file was stored on server $size = getimagesize($_FILES[$key]['tmp_name']); $sizekb = filesize($_FILES[$key]['tmp_name']); // if image size exceeds defined maximum size, output error // otherwise continue if ($sizekb > MAX_SIZE*1024) { echo '<div class="failure">Fehler bei Datei '. $_FILES[$key]['name'] .': Die Datei konnte nicht hochgeladen werden: die Dateigröße überschreitet das Limit von 2MB.</div>'; } else { $rand = md5(rand() * time()); // create random file name $image_name = $rand.'.'.$extension; // unique name (random number) // new name contains full path of storage location (images folder) $consname = "photos/".$image_name; // path to big image $consname2 = "photos/thumbs/".$image_name; // path to thumbnail $copied = copy($_FILES[$key]['tmp_name'], $consname); $copied = copy($_FILES[$key]['tmp_name'], $consname2); $sql="INSERT INTO photos (galery_id, photo, thumb) VALUES (". $id .", '$consname', '$consname2')" or die(mysql_error()); $query = mysql_query($sql) or die(mysql_error()); // if image hasnt been uploaded successfully, output error // otherwise continue if (!$copied) { echo '<div class="failure">Fehler bei Datei '. $_FILES[$key]['name'] .': Die Datei konnte nicht hochgeladen werden.</div>'; } else { $thumb_name = $consname2; // path for thumbnail for creation & storage // call to function: create thumbnail // parameters: image name, thumbnail name, specified width and height $thumb = make_thumb($consname,$thumb_name,WIDTH,HEIGHT); $thumb = make_thumb($consname,$consname,WIDTH2,HEIGHT2); } } } } } // current image could be uploaded successfully echo '<div class="success">'. $success .' Foto(s) erfolgreich hochgeladen!</div>'; showForm(); // call to function: create upload form }

    Read the article

  • Storing uploaded content on a website

    - by Matt
    For the past 5 years, my typical solution for storing uploaded files (images, videos, documents, etc) was to throw everything into an "upload" folder and give it a unique name. I'm looking to refine my methods for storing uploaded content and I'm just wondering what other methods are used / preferred. I've considered storing each item in their own folder (folder name is the Id in the db) so I can preserve the uploaded file name. I've also considered uploading all media to a locked folder, then using a file handler, which you pass the Id of the file you want to download in the querystring, it would then read the file and send the bytes to the user. This is handy for checking access, and restricting bandwidth for users.

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >