2

I'm having issues in uploading files using PHP. The files are hosted on AWS. My form looks like this:

<form name="hello" method="post" action="" enctype="multipart/form-data" >
        <label>Image</label>
        <input type="file" name="image" />
        <label>Audio file</label>
        <input type="file" name="audio_file" />
        <input type="submit" value="Add" />  
</form>

When i submit this form nothing happens the page keeps on loading. I tried by removing one file control and it worked fine i.e one file was uploaded successfully. If i submit only one file then it works fine but not when there are two different file controls.

PHP ini settings looks like this:

max_file_uploads 10
memory_limit 1024M
upload_max_filesize 32M
post_max_size 32M

Not sure what's the issue.

Thanks!

John Snow
  • 61
  • 6
  • Your action is blank, is the page with the form the same as the URL where the upload will be processed? Remember, when you upload a file, it will wait for the browser to send the file **before** running the script, so if it's a large file you'll need to wait a while. – Geoff Atkins Jun 04 '15 at 09:42
  • Yes form action is same as the page url. File size < 1 MB. This form works only with one file control. If i upload only a picture then it will upload just fine. But if i try to upload two different files using two file controls it doesn't. – John Snow Jun 04 '15 at 09:46
  • can you post php code? – Vel Jun 04 '15 at 10:28
  • I'm using Codeigniter's upload library for uploading the files. I tried with one file and it was uploaded successfully. So there is nothing wrong with the upload library. I even tried with core PHP code and the result was same. When i print the content of $_FILES array it shows correctly in case of one file. But when i use two file controls to upload two different files it doesn't work. The page keeps on loading. I checked the error logs as well but no errors. – John Snow Jun 04 '15 at 10:41
  • $filea = $_FILES['filea']; $fileb = $_FILES['fileb']; move_uploaded_file($filea['tmp_name'], '/destination/'.$filea['name']);move_uploaded_file($fileb['tmp_name'], '/destination/'.$fileb['name']); – Vel Jun 04 '15 at 10:46
  • Yes i've tried this as well. But the page just keeps on loading. It works only when there is one file control in the form. – John Snow Jun 04 '15 at 10:48
  • http://stackoverflow.com/questions/11524356/multiple-files-upload-array-with-codeigniter-2-0 try this – Vel Jun 04 '15 at 10:49
  • Thanks for the suggestion. But did you read my question? I don't want to upload multiple files using one file control. I want to upload two files using two file controls in the form. – John Snow Jun 04 '15 at 10:53
  • Sorry i dont know about Codeigniter. Am learning Codeigniter. – Vel Jun 04 '15 at 10:55
  • No need to apologize. It has nothing to do with codeigniter. Its a simple upload functionality and it should work fine. Don't know if its a server issue! – John Snow Jun 04 '15 at 10:58

1 Answers1

1

The issue was with our internal network (static IP).

John Snow
  • 61
  • 6