Search Results

Search found 208 results on 9 pages for 'enctype'.

Page 5/9 | < Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >

  • Uploading a file fails under WordPress

    - by Ash
    I'm using WordPress and I'm following W3's guide for uploading a file: HTML code: <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> </html> PHP code (upload_file.php): <?php if ($_FILES["file"]["error"] > 0) { echo "Error: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Stored in: " . $_FILES["file"]["tmp_name"]; } ?> The HTML code is pasted in a PHP page template and the PHP file under the WP installation directory under www. The problem is when I submit the file I get Error: 1. If I remark the "if" part of the PHP code and leave the "else" part I get: Upload: IMG_4258.JPG Type: Size: 0 Kb Stored in: So at least I know the PHP code is running. But what's causing it to fail? Is there a problem with the code or is WordPress meddling with the process?

    Read the article

  • Why Response.Write behavior varies in the given scenario?

    - by Sri Kumar
    Hello All, When i POST the page using the following code, the Response.write("Hey") doesn't write the content ("Hello") to the parent page <form method="post" name="upload" enctype="multipart/form-data" action="http://localhost:2518/Web/CrossPage.aspx?cmd=getvalue" > <input type="file" name="filename" /> <input type="submit" value="Upload Data File" name="cmdSubmit" /> </form> But When i use following code , and POST the data, the Response.write("Hey") can be obtained in the parent page HttpWebRequest requestToSender = (HttpWebRequest)WebRequest.Create("http://localhost:2518/Web/CrossPage.aspx?cmd=getvalue"); requestToSender.Method = "POST"; requestToSender.ContentType = "multipart/form-data"; HttpWebResponse responseFromSender = (HttpWebResponse)requestToSender.GetResponse(); string fromSender = string.Empty; using (StreamReader responseReader = new StreamReader(responseFromSender.GetResponseStream())) { fromSender = responseReader.ReadToEnd(); } In the CrossPage.aspx i have the following code if (!Page.IsPostBack) { NameValueCollection postPageCollection = Request.Form; foreach (string name in postPageCollection.AllKeys) { Response.Write(name + " " + postPageCollection[name]); } HttpFileCollection postCollection = Request.Files; foreach (string name in postCollection.AllKeys) { HttpPostedFile aFile = postCollection[name]; aFile.SaveAs(Server.MapPath(".") + "/" + Path.GetFileName(aFile.FileName)); } Response.Write("Hey"); } I don't have any code in the Page_Load event of parent page.? What could be the cause? I need to write the "hey" to the Parent page using the first scenario. Both the application are of different domain. Edit: "Hey" would be from the CrossPage.aspx. I need to write this back to the Parent Page

    Read the article

  • I am unable to upload file to my local host folder in php.

    - by Nauman khan
    Hi, I have the follwing code <form enctype="multipart/form-data" action="upload.php" method="POST"> Please choose a file: <input name="uploaded" type="file" /><br /> <input type="submit" value="Upload" /> </form> <?php $target = "upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } ?> my page is in http://localhost/nausal/upload.php now I am having the follwing error though i have created a folder in site with name upload. Notice: Undefined index: uploaded in C:\wamp\www\Nausal\upload.php on line 15 Notice: Undefined index: uploaded in C:\wamp\www\Nausal\upload.php on line 17 Sorry, there was a problem uploading your file. Please help me I am very new to php. :(

    Read the article

  • Why is my PHP upload script not working?

    - by Turner
    Hello all, I am doing some simple work with uploading a file. I am ignoring error checking and exceptions at this point just to get my uploads working. I have this HTML form: <form action='addResult.php' method='post' enctype='multipart/form-data' target='results_iFrame' onsubmit='startUpload();'> Entry: <input type='text' id='entry' /> Stop: <input type='text' id='stop' /> Final: <input type='text' id='final' /> Chart: <input type='file' id='chart' /> <input type='submit' value='Add' /></form> As you can see, it calls 'addResult.php' within the iFrame 'results_iFrame'. The Javascript is just for animation purposes and to tell me when things are finished. addResult.php has this code in it (along with processing the other inputs): $upload_dir = "../img/"; $chart_loc = $upload_dir.basename($_FILES['chart']['name']); move_uploaded_file($_FILES['chart']['tmp_name'], $chart_loc); print_r($_FILES); It uses the 'chart' input from the form and tries to upload it. I have the print_r() function to display some information on $_FILES, but the array is empty, thus making this fail. What could I be doing wrong?

    Read the article

  • larger file upload problem with php

    - by chris
    I need to upload a csv file to a server. works fine for smaller files but when the file is 3-6 meg its not working. $allowedExtensions = array("csv"); foreach ($_FILES as $file) { if ($file['tmp_name'] > '') { if (!in_array(end(explode(".", strtolower($file['name']))), $allowedExtensions)) { die($file['name'].' is an invalid file type!<br/>'. '<a href="javascript:history.go(-1);">'. '&lt;&lt Go Back</a>'); } if (move_uploaded_file($file['tmp_name'], $uploadfile)) { echo "File is valid, and was successfully uploaded.\n"; } else { echo "Possible file upload attack!\n"; } echo "File has been uploaded"; } //upload form <form name="upload" enctype="multipart/form-data" action="<? echo $_SERVER['php_self'];?>?action=upload_process" method="POST"> <!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="31457280" /> <!-- Name of input element determines name in $_FILES array --> Send this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /> </form> I have also added this to htaccess php_value upload_max_filesize 20M php_value post_max_size 20M php_value max_execution_time 200 php_value max_input_time 200 Where am i going wrong?

    Read the article

  • Pass a model object while using a upload

    - by Dejan.S
    I'm trying to pass my model object along with the file I'm uploading but I'm stuck on how I should that should be done. This is the code I use now [AcceptVerbs(HttpVerbs.Post)] public ActionResult Upload(PageBody pageBody) { foreach (string file in Request.Files) { var hpf = Request.Files[file] as HttpPostedFileBase; if (hpf.ContentLength == 0) continue; string savedFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "Content/Uploads/", Path.GetFileName(hpf.FileName)); hpf.SaveAs(savedFileName); _pageBody.Pictures.Add(new PageBodyPicture() { Picture = file }); } return View(pageBody); } here is my view code, I got the model.Id but there but it wont pass even if I put just Id to the Upload method. <form action="/Admin/Upload" enctype="multipart/form-data" method="post"> <%= Html.HiddenFor(model => model.Id)%> <input type="file" name="file" id="file" /><br /> <input type="submit" name="submit" value="Upload" /> </form>

    Read the article

  • AJAX: Permission denied to access property in iframe

    - by Muhammad Sajid
    Hi I created an php website which uses for AJAX post and was live at http://sprook.com.au/ but my client change it's domain to http://www.sprookit.net/ from his service provider Godaddy and now the firebug says: Permission denied to access property 'stopAjax' here stopAjax is my method name. script is there: <div class="post_area"> <form action="post.php" method="post" id="addVideo" enctype="multipart/form-data" target="post" onsubmit="return startAjax(this);"> <iframe id="post" name="post" src="#" style="width:0;height:0;border:0px solid #fff;"></iframe> <table width="860" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="435">POST YOUR AD FREE<br /> <em>Paste embed code from YouTube</em></td> <td width="322"><input type="text" id="videoLink" name="videoLink" class="input_textbox" /> </td> <td width="95"><input type="submit" name="set_video_link" id="set_video_link" value="" class="submt_post" /> </td> </tr> <tr> <td>&nbsp;</td> <td><div id="process"> Connecting please wait <img src="images/loading.gif" /><br/> </div></td> </tr> </table> </form> </div> And all content comes from old domain i removed index file and it stoped working, therefore it is cleared that scripts run from old domain.

    Read the article

  • How to upload files to server using JSP/Servlet?

    - by Thang Pham
    How can I upload files to server using JSP/Servlet? I tried this: <form action="upload" method="post"> <input type="text" name="description" /> <input type="file" name="file" /> <input type="submit" /> </form> However, I only get the file name, not the file content. When I add enctype="multipart/form-data" to the <form>, then request.getParameter() returns null. During research I stumbled upon Apache Common FileUpload. I tried this: FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); List items = upload.parseRequest(request); // This line is where it died. Unfortunately, the servlet threw an exception without a clear message and cause. Here is the stacktrace: SEVERE: Servlet.service() for servlet UploadServlet threw exception javax.servlet.ServletException: Servlet execution threw an exception at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:313) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:852) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:637)

    Read the article

  • Selecting a form which is in an iframe using jQuery

    - by Khnle
    I have a form inside an iframe which is inside a jQuery UI dialog box. The form contains a file input type. The jQuery UI dialog contains an Upload button. When this button is clicked, I would like to programmatically call the submit method. My question is how I could select the form which is in a iframe using jQuery. The following code should clarify the picture: <div id="upload_file_picker_dlg" title="Upload file"> <iframe id="upload_file_iframe" src="/frame_src_url" frameborder=0 width=100% scrolling=no></iframe> </div> frame_src_url contains: <form action="/UploadTaxTable" enctype="multipart/form-data" method="post" id="upload-form"> <p>Select a file to be uploaded:</p> <p> <input type="file" name="datafile" size="60"> </p> The jQueryUI dialog box javascript code: $('#upload_file_picker_dlg').dialog({ ... buttons: { 'Close': function() { $(this).dialog('close'); }, 'Upload': function() { $('#upload-form').submit(); //question is related to this line $(this).dialog('close'); } }, .... }); From the javascript code snippet above, how can I select the form with id upload-form that is in the iframe whose id is upload_file_iframe ?

    Read the article

  • How to post only a specific ASCX partial instead of the whole page

    - by Hallaghan
    I've got an ASPX page rendering a search ascx page which in turn will fill a grid on the main ASPX page. Aside that, I've also got an ascx page which uploads files, like this: <form method="post" action="<%= Url.Action("UploadFile") %>" enctype="multipart/form-data"> <fieldset> <input type="file" name="file" id="file" /> <%=Html.ButtonSubmit("Upload") %> </fieldset></form> Here's the problem: imagine I have searched for a single entry to be displayed on the grid. The grid displays this single entry and after wards, I upload a file and press the button "Upload". The whole page gets posted and the content in the grid is lost, now displaying all the results available. What could I do to prevent this from happening, maintaining the grid state (we're not using ViewState) or otherwise not posting back the whole page but only the ascx with the file upload? Note: I'm new to MVC.

    Read the article

  • Can I attach data gathered by a form to a file that is being uploaded?

    - by Jacob
    I need customers to upload files to my website and I want to gather their name or company name and attach it to the file name or create a folder on the server with that as the name so we can keep the files organized. Using PHP to upload file PHP: if(isset($_POST['submit'])){ $target = "upload/"; $file_name = $_FILES['file']['name']; $tmp_dir = $_FILES ['file']['tmp_name']; try{ if(!preg_match('/(jpe?g|psd|ai|eps|zip|rar|tif?f|pdf)$/i', $file_name)) { throw new Exception("Wrong File Type"); exit; } move_uploaded_file($tmp_dir, $target . $file_name); $status = true; } catch (Exception $e) { $fail = true; } } Other PHPw/form: <form enctype="multipart/form-data" action="" method="post"> input type="hidden" name="MAX_FILE_SIZE" value="1073741824" /> label for="file">Choose File to Upload </label> <br />input name="file" type="file" id="file" size="50" maxlength="50" /><br /> input type="submit" name="submit" value="Upload" /> php if(isset($status)) { $yay = "alert-success"; echo "<div class=\"$yay\"> <br/> <h2>Thank You!</h2> <p>File Upload Successful!</p></div>"; } if(isset($fail)) { $boo = "alert-error"; echo "<div class=\"$boo\"> <br/> <h2>Sorry...</h2> <p>There was a problem uploading the file.</p><br/><p>Please make sure that you are trying to upload a file that is less than 50mb and an acceptable file type.</p></div>"; }

    Read the article

  • Please help with IFrame callback

    - by Code Sherpa
    Hi - thanks for clicking. I am trying to get status feedback using an IFrame for file uploads. I am not trying to get progress or percentages - just when a file is done uploading and if it was a success or failure. THE PROBLEM is that I can't seem to get the server response to appear on the client. I have to following design: I have an iframe on my page: <iframe id="target_frame" src="" style="border:0px; width:0px; height:0px"></iframe> The form tag points to it: <form enctype="multipart/form-data" id="fileUploadForm" name="fileUploadForm" action="picupload.aspx" method="post" target="target_frame"> And the submit button starts a file upload via the iframe: <input id="submit" type="submit" value="upload" /> In the picupload.aspx.cs file, I have a method that returns dynamic data. I then send it to the client: message = data; Response.Write(String.Format("<script language='javascript' type='text/javascript'>window.parent.handleResponse('{0}');</script>", message)); On the client, I have a response handler: function handleResponse(msg) { document.getElementById('statusDiv').innerHTML = msg; } My intent is to see the msg value change for each uploaded file but I never see anything appear in statusDiv, let alone dynamically changing messages. Can somebody please help??

    Read the article

  • How to run perl script with a few arguments from php

    - by Cristalla
    My html webpage calls php script to upload files to the server from a local computer as follows. <form enctype="multipart/form-data" action="upload.php" method="POST"> <p><b><h3> <font color="#003366"> (1) Upload your reading text file. </font> </h3> </b> </p> <INPUT type="file" name="uploaded" size="50" > <br/> <input type="submit" name="files" value="upload"> </form> In order to process with an uploaded file, my php script calls shell script $output=system('/bin/sh connector_0.sh'); and my shell script is composed of a series of python/perl scripts. #!/bin/sh python main_senselearner_final_0.py senseLearner.pl -i Uploaded_Files/slinput_0.txt -o Uploaded_Files/presloutput_0 .txt -model modelNNCollocations -model modelJJCollocations -model modelVBColloc ations -pos python smutngslout_0.py python genhtml_0.py Now, the problem is the following: all python scripts in shell script worked fine through php. But perl script didn't work. When I run shell script by myself in my server, all four scripts in shell worked perfectly. However, when I run shell script from php, only perl script doesn't work. Would you please give me any tips to solve this problem? Many thanks!!!

    Read the article

  • Uploading File Problem in PHP on Drupal

    - by Nitz
    I don't know why but i had written clear cut code for uploading file in my page. i had written like this... on the client side. <form id="recipeform" onsubmit="return checkAll()" action="submit.php" method="post" class="niceform" enctype="multipart/form-data"> <input name="uploaded" type="file" /> And on submit.php... i am writting like this..... $target = "newupload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)){ echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded"; } else{ echo "Sorry, there was a problem uploading your file."; } simple code but then also i can't able to upload the file.. And i had made my webiste in Drupal. Thanks in advance. www.panchjanyacorp.com

    Read the article

  • Upload file using jquery dialog not working

    - by kandroid
    i want to upload file using jquery dialog. I have created a partial view and showing that partial view in the dialog. The problem is, when I directly browse the partial view and upload a file, it works perfect. BUT when I put the partial view inside a jquery dialog, it submits the form, but don't submits the file. So i have null value. I really dont understand what is the difference here!! Hope someone can help me to identify the problem. here is some codes; jquery codes: $('#UploadDialog').dialog({ autoOpen: false, width: 580, resizable: false, modal: true, open: function (event, ui) { $(this).load('@Url.Action("Upload","Notes")'); }, buttons: { "Upload": function () { $("#upload-message").html(''); $("#noteUploadForm").submit(); }, "Cancel": function () { $(this).dialog("close"); } } }); $(".uploadLink").click(function () { $('#UploadDialog').dialog('open'); }); return false; }); partial view: @using (Ajax.BeginForm("Upload", "Notes", null, new AjaxOptions { UpdateTargetId = "upload-message", InsertionMode = InsertionMode.Replace, HttpMethod = "POST", OnSuccess = "uploadSuccess" }, new { id = "noteUploadForm" , enctype="multipart/form-data"})) { <div> <div id="upload-message"></div> <div class="editLabel"> @Html.LabelFor(m => m.Notes.NoteTitle) </div> <div class="editText"> @Html.TextBoxFor(m => m.Notes.NoteTitle) </div> <div class="clear"></div> <div class="editLabel"> @Html.Label("Upload file") </div> <div class="editText"> <input type="file" name="file" />(100MB max size) </div> </div> }

    Read the article

  • how to read uploaded files from xampp

    - by user225269
    I have this code for uploading files on the server: <tr> <td> <form enctype="multipart/form-data" action="uploadaction.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> </td> </tr> <tr> <td> Select the image: <input name="uploadedfile" type="file" /> </td> <tr> <td> <input type="submit" value="Upload File" /> </form> </td> </tr> And here's the action form: <?php $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> What php function will I use? Can you give me an example on how to read the file back and display it in the browser? Please help, thanks.

    Read the article

  • listener not being called

    - by deb
    I have a table with a button. When the button is clicked I call Modalbox.show (http://okonet.ru/projects/modalbox/) that displays a little form with another button. When the user clicks this second button, a listener is attached to an iframe in the form and the form is submitted to the server. The server does something then it should return back to the form and execute the listener function. This works fine on IE but not in Firefox (on Firefox it never comes back). Here it is the javascript function that is called when the user presses the second button (in the Modalbox) function attachFile() { //window.frames['upload_iframe'].name='upload_iframe'; iframe = document.getElementById('upload_iframe'); if (iframe.addEventListener)//FF iframe.addEventListener("load", iframeEventHandler, false); if (iframe.attachEvent)//IE iframe.attachEvent("onload", iframeEventHandler); // Set properties of form... form = document.getElementById('attchForm'); form.setAttribute("target","upload_iframe"); form.setAttribute("method","post"); form.setAttribute("enctype","multipart/form-data"); form.setAttribute("encoding","multipart/form-data"); // Submit the form... form.submit(); } I checked that it is adding the listener but somehow does not return to it. Any hints? Thanks deb

    Read the article

  • ThickBox - update inside without redirect

    - by Alex Maslakov
    ASP.NET MVC and jQuery ThickBox. I show some content in ThickBox. It includes file upload form The view multi-media.apsx (it's strange, the this editor doesn't allow start the line with "<" in the code) form action="/upload/multi-media" method="post" enctype="multipart/form-data" label for="file"File name: input type="file" name="file" id="file" / input type="submit" value="Upload" / <% if (Model.Count > 0) { foreach (FileInfo mediaFile in Model) { <img width="100px" height="100px" src="<%: ResolveUrl("~/audio.png") %>" border="0" alt="<%: mediaFile.Name %>" / //................ After file upload I redirect to /upload/multi-media action and content shows in normal window, not in ThickBox. [ActionName("multi-media"), HttpPost] public ActionResult MultiMedia(HttpPostedFileBase file) { if (file.ContentLength > 0) { file.SaveAs(GenerateNewFileName(fullFileName)); return View("multi-media", model); } } How can I stay into ThickBox after file upload? I need show content in ThickBox all the time, even after the file upload.

    Read the article

  • <input type="file"> reads only file name not full path

    - by Deep
    I am using Glassfish Server.I have seen the apache file upload to solve it...but i want to implement it in glassfish server. image.html <form action="" method="post" enctype="multipart/form-data"> Select a file: <input type="file" name="first" id="first"/> <br /> <input type="button" name="button" value="upload" id="button" /> <p id="test"></p> <img src='Unknown.png' id="profile_img" height="200px" width="150px"/> </form> test.js $(document).ready(function() { var filepath= $("#first"); $('#button').click(function() { $.ajax({ type: "post", url: "imageservlet", data: "user="+filepath.val(), success: function(msg) { $("#profile_img").attr('src',msg); $("#test").html(msg) .fadeIn("fast"); } }); }); }); imageservlet.java String user=request.getParameter("user"); out.print(user); the output is file name not full path.

    Read the article

  • Error while sending image through ajax to WCF

    - by Samar Rizvi
    Here is my form: <form id="register" enctype="multipart/form-data"> <input type="text" name="first_name" placeholder="First Name" id="first_name" /> <input type="text" name="last_name" placeholder="Last Name" id="last_name" /> <input type="text" name="input_email" placeholder="Confirm your email" id="input_email" class="loginEmail" /> <input type="password" name="input_password" placeholder="Password" id="input_password" class="loginPassword" /> <input type="password" name="repeat_password" placeholder="Repeat password" id="repeat_password" class="loginPassword" /> <input type="file" name="image_file" id="image_file" /> <div class="logControl"> <div class="memory"></div> <input type="submit" name="submit" value="Register" class="buttonM bBlue" id="register_submit"/> <div class="clear"></div> </div> <p><h3>Or click <a href="login.html">here</a> to login</h3></p> </form> Here is jquery call that I make: function WCFJSON() { $(".memory").html('<img src="images/elements/loaders/7s.gif" />'); Data = new FormData($('form')[0]); $.ajax({ type: 'POST', //GET or POST or PUT or DELETE verb url: "WCFService/Service.svc/Register", // Location of the service data: Data, //Data sent to server async:false, cache:false, contentType: false, // content type sent to server dataType: DataType, //Expected data format from server processdata: false, //True or False success: function(msg) {//On Successfull service call ... }, error: ...// When Service call fails }); } $(document).ready(function(){ $("#register").submit(function(){ $('#input_password').val(CryptoJS.MD5($('#input_password').val())); $('#repeat_password').val(CryptoJS.MD5($('#repeat_password').val())); WCFJSON(); return false; }); }); Now when I submit the form , page refreshes with get elements in the url. But if I remove the file input from the form, jquery works fine.

    Read the article

  • Upload to a PHP Server, using Ajax ( XMLHttp POST)

    - by Krishnanunni
    Right now i'm using the below method to Upload a file to PHP <form enctype="multipart/form-data" action="http://sserver.com/fileupload.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="30000000" /> <input type="hidden" name="filename" value="file_uploaded.gif" /> <input type="hidden" name="username" value="foobar"/> Please choose a file: <input name="uploaded" type="file" /><br /> <input type="submit" value="Upload" /> </form> I read the $_POST and $_FILE in php to complete upload like this. $target = $_SERVER['DOCUMENT_ROOT']."/test/upload/"; $target = $target . basename( $_FILES['uploaded']['name']) ; echo $target; $ok=1; if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) { echo "The file ". basename( $_FILES['uploaded']['name']). " has been uploaded"; } else { echo "Sorry, there was a problem uploading your file."; } My questions is , can i change the above said code (HTML) to an Ajax XMLHttpRequest without changes in PHP.

    Read the article

  • How can I measure the time it takes a file to upload to a PHP script?

    - by Gustav Bertram
    I am trying to measure the time a script takes to upload a file to a PHP script, inside the receiving script. Here's a short example: <form action="#" enctype="multipart/form-data" method="post"> Upload: <input type="file" name="datafile" size="40"> <input type="submit" value="Send"> </form> <?php $upload_time = time() - $_SERVER['REQUEST_TIME']; echo $upload_time . " seconds."; I've submitted 4MB, 25MB, 100MB and 1.4GB files. They took anything from a fraction of a second, to almost a minute, yet the script above always yielded 0 seconds. NOTE: I know that this is a duplicate question, but the accepted answer on the other question did not work for me (at least, initially): Detect how long it takes for a file to upload (PHP) I've tried it using PHP 5.3.3 with Apache 2.2.16 on Ubuntu 10.4. UPDATE: I've discovered that both the Apache header and Ajax solutions work. In fact, the solution on the duplicate question also works. The critical element to making these solutions work is to ensure that the following values in the php.ini are sufficiently high: memory_limit = 1000M upload_max_filesize = 1000M post_max_size = 1000M I am accepting the Apache header solution, since it only uses PHP.

    Read the article

  • Passing HTML form data in the URL on local machine (file://)

    - by atzz
    Hi, I'm building a small HTML/JS application for primary use on local machine (i.e. everything is accessed via file:// protocol, though maybe in the future it will be hosted on a server within intranet). I'm trying to make a form with method="get" and action="target.html", in the hope that the browser will put form data in the URL (like, file://<path>/target.html?param1=aaa&param2=bbb). However, it's not happening (target.html opens fine, but no parameters is passed). What am I doing wrong? Is it possible to use forms over file:// at all? I can always build the url manually (via JS), but being lazy I'd prefer the browser do it for me. ;) Here is my sample form: <form name='config' action="test_form.html" method="get" enctype="application/x-www-form-urlencoded"> <input type="text" name="param1"> <input type="text" name="param2"> <input type="submit" value="Go"> </form>

    Read the article

  • can't upload greater 50MB

    - by Syom
    i want to upload two files. here is the script <? ini_set('memory_limit', "400M"); ini_set('file_uploads', "5"); ini_set('max_execution_time', "900"); ini_set('upload_max_filesize', "400M"); ini_set('post_max_size', "400M"); ?> <form action="form.php" method="post" enctype="multipart/form-data" /> <input type="file" name="video" /> <input type="file" name="picture" > <input type="submit" class="input" value="?????" /> </form> form.php: <? ini_set('memory_limit', "400M"); ini_set('file_uploads', "5"); ini_set('max_execution_time', "900"); ini_set('upload_max_filesize', "400M"); ini_set('post_max_size', "400M"); print_r($_FILES); //returns Array ( ) ?> i've asked about this question here , and i've set ini_set(...) as you see, but when i try to upload the file greater than 50MB, it doesn't happen. could you tell me why?

    Read the article

  • multiple form submission with one submit

    - by skylab
    I've been trying to think this through and figure out if it is possible or not. I'm using zen-cart as shopping cart software, but what I'd like to do, is hard code a page that is basically a list of 7-9 products, next to each product is a checkbox, so I'd like to figure out a way, via html,javascript or jquery to submit whichever forms(products) are checked to the cart. The typical form submission for a product looks something like this(sometimes there may be one or two additional hidden fields): <form name="cart_quantity" action="index.php?action=add_product" method="post" enctype="multipart/form-data"> <input type="hidden" name="cart_quantity" value="1"> <input type="hidden" name="products_id" value="7"> <input type="hidden" name="id[6]" value="9" id="attrib-6-9"> <input type="image" src="buy_button.png" alt="Add to Cart" title="Instructional Video Part 1: Add to Cart"> </form> There would be 7-9 of these on the page, each with a checkbox, so I'm assuming a script would need to figure out which ones where checked and submit them via the form action? Maybe there is a better way of going about this that I'm not thinking of because a)it's over my head or b)just haven't figured it out yet. Anyway is something like this possible?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9  | Next Page >