upload

Handling file upload from HTML form in ASP.net MVC 3 c#

人盡茶涼 提交于 2020-01-30 11:58:05
问题 I have plenty of experience with this in PHP, but am fairly new to ASP.net. I've found some tutorials around the web which have gotten me this far, but I am currently running into issues. So to summarize what I'm trying to accomplish, I have a page where I want users to submit contest entries. I use a HTML form to collect things like entry title, description, and want to allow them to be able to submit an image representing their entry. When they choose to provide an image, I want it uploaded

How to redirect user after file upload using PHP

江枫思渺然 提交于 2020-01-30 11:21:25
问题 As the title says, I wish to redirect a user back to the main page after they have uploaded a file, so far, all this code does is display a page with the relevant information (File name, file size etc..) I want to redirect them to a custom success page. HTML: <html> <body> <form action="upload_file.php" method="post" enctype="multipart/form-data"> <label for="file">Filename:</label> <input type="file" name="file" id="file"><br> <input type="submit" name="submit" value="Submit"> </form> </body

How can I upload a file using AJAX without using multipart?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-30 08:35:25
问题 The only file my app allows users to upload are images, and they are always uploaded as the sole input field in a form. Thus, multipart is unnecessary, and I could much more easily consume the file without a multipart parser. How can upload a file without using multipart using AJAX and vanilla Javascript? Also, it should generally support the latest version of all browsers. 回答1: You can simply send the associated File or Blob itself via XHR level 2. For example, in the upload library I

Apache 403 Forbidden When Uploading Files

做~自己de王妃 提交于 2020-01-29 09:52:37
问题 I'm having a strange apache error when I submit a multipart/form-data form with an input file. It seems that only happens when I upload files 70kb or bigger. Here are my php.ini settings: file_uploads = On upload_max_filesize = 10M max_execution_time = 90 max_input_time = 90 memory_limit = 196M post_max_size = 10M Here is the HTML in test.php: <form action="" method="POST" enctype="multipart/form-data"> <input type="file" name="pdfMagazine" /> <input type="submit" value="Save" name=

Apache 403 Forbidden When Uploading Files

余生颓废 提交于 2020-01-29 09:52:28
问题 I'm having a strange apache error when I submit a multipart/form-data form with an input file. It seems that only happens when I upload files 70kb or bigger. Here are my php.ini settings: file_uploads = On upload_max_filesize = 10M max_execution_time = 90 max_input_time = 90 memory_limit = 196M post_max_size = 10M Here is the HTML in test.php: <form action="" method="POST" enctype="multipart/form-data"> <input type="file" name="pdfMagazine" /> <input type="submit" value="Save" name=

ASP.NET MVC upload image

断了今生、忘了曾经 提交于 2020-01-28 10:26:28
问题 I've found some code to do this and tried to implement it into my project, but so far it has been unsuccessful. I don't get any errors, but I don't see any images being stored in my images directory inside visual studio. View: @using (Html.BeginForm()) { <span>Please enter your story here:</span> <textarea id="testimonial" name="testimonial"></textarea> <button type="submit">Submit</button> <input type="file" name="file" /> } Controller: [HttpPost] public ActionResult Create(Testimonials

Display selected file in html input before upload

血红的双手。 提交于 2020-01-25 18:27:44
问题 How can i show file that i select thru browse field into html input? I want to see file that i selected before i press upload? Here is my code: <input id="uploadFile" name="uploadFileOne" type="text" disabled="disabled" value="<?php echo $file_name; ?>" placeholder="EWIS" class="name-info-form file-witdth" /> <input class="upload" type="file" id="uploadOne" name="uploadOne" value="Select File"/ > 回答1: <form> <input class="upload" type="file" id="uploadOne" name="uploadOne" onchange=

upload multiple files to server, and write to database

空扰寡人 提交于 2020-01-25 08:43:07
问题 So at the moment I have the following code in my html <input type="file" required required="required" name="image" multiple=""> and then before I added the mutliple="" tag, this always worked for me, if(isset($_POST['Submit'])) { $current_image=$_FILES['image']['name']; $extension = substr(strrchr($current_image, '.'), 1); if (($extension!= "png") && ($extension != "jpg")) { die('Unknown extension'); } $time = date("fYhis"); $new_image = $time . "." . $extension; $destination="./../img

How to make so people can upload files to my website and display them?

非 Y 不嫁゛ 提交于 2020-01-25 07:26:09
问题 How to make so people can upload files to my website and display them, for example, I want people to be able to upload books like archive.org. FYI I do not know PHP. Heres my code <html> <head> <title>Book Store</title> <link rel="shortcut icon" href="logo2.ico" /> <link href = "style1.css" type = "text/css" rel = "stylesheet" /> </head> <body> <style> </style> </div> <h1>Book Store</h1> <input type="text" id="booksearch" onkeyup="search()" placeholder="Search for books.."size="40"> <ul id=

jQuery AJAX file upload PHP

自作多情 提交于 2020-01-25 06:46:05
问题 I want to implement a simple file upload in my intranet-page, with the smallest setup possible. This is my HTML part: <input id="sortpicture" type="file" name="sortpic" /> <button id="upload">Upload</button> and this is my JS jquery script: $("#upload").on("click", function() { var file_data = $("#sortpicture").prop("files")[0]; var form_data = new FormData(); form_data.append("file", file_data); alert(form_data); $.ajax({ url: "/uploads", dataType: 'script', cache: false, contentType: false,