Handle multiple file upload

General discussions related to php

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Mon Sep 23, 2013 11:38 pm

Handle multiple file upload

Postby nanieaziz » Tue Sep 24, 2013 12:25 am

Hi. I have problem on how to handle / manage the multiple file upload from multiple input... I already read from many sources but I'm so slow to digest it. I edit here and there, end up only errors I faced. :( What I am trying to do once submitted,
1- the file will be stored in a folder 'upload' and under id. (eg:../upload/1234/acceptletter.doc , ../upload/1234/turnitin.pdf and so on). It will be easier to retrieve the dir later.

2- the file will be store in table submission. Below is the table. I'm trying to store the file upload in the field labelled file1, file 2 and so on. I haven't decide to use BLOB or varchar2 (please suggest me anything)

Code: Select all

CREATE TABLE submission
    matricNo VARCHAR2 (10)NOT NULL,
    sponsor VARCHAR2(10),
    admissionDate DATE NOT NULL,
    programme VARCHAR2(10),
     sem VARCHAR2(4) NOT NULL,
    field VARCHAR2(10) NOT NULL,
    supervisor VARCHAR2(50) NOT NULL,
    cosupervisor VARCHAR2(50) NOT NULL,
     papertitle VARCHAR2(50) NOT NULL,
    author VARCHAR2(150) NOT NULL,
    conftitle VARCHAR2(50) NOT NULL,
    organizer VARCHAR2(20),
    orgaddress VARCHAR2(50),
    orgtel VARCHAR2(20),
    venue VARCHAR2(30),
    confDate DATE,
    fee NUMBER(10),
    file1 VARCHAR2(30) NOT NULL,
    file2 VARCHAR2(30) NOT NULL,
    file3 VARCHAR2(30),
    indexurl VARCHAR2(30),
     file4 VARCHAR2(30) NOT NULL,
     submitversionurl VARCHAR2(30) NOT NULL,
    confpaperurl VARCHAR2(30),
    file5 VARCHAR2(30) NOT NULL,
    file6 VARCHAR2(30) NOT NULL);

Below is the form.. (I display the upload section only since its a long form)

Code: Select all

<fieldset style="width:500px; background-color: #FFC"><legend align="center" style="font-size:24px">Upload file</legend>
<p style="color:#F00"> ( Please take note to name your files accordingly and save as .pdf or .doc ) </p>
<table width="809" cellpadding="2" cellspacing="2">
  <td width="252"><label for="file">Acceptance Letter from Publisher:</label></td>
  <td width="541"><input type="file" name="file[]" id="acceptletter" onchange=checkFile(this)  required value=""></td>
  <td width="252"><label for="file">Turnitin Similarity Report :</label></td>
  <td width="541"><input type="file" name="file[]" id="turnitin" onchange=checkFile(this) required value=""></td>
  <td width="252"><label for="file">Paper Indexing :</label></td>
  <td width="541"><input type="file" name="file[]" id="paperindex" onchange=checkFile(this) > <br />/ Link : <input type="text" name="paperindexurl" size="30" /></td>
  <td width="252"><label for="file">Publisher's Reviewers Report :</label></td>
  <td width="541"><input type="file" name="file[]" id="reviewerReport" onchange=checkFile(this) required value=""></td>
  <td width="252"><label for="file">Paper Submitted Version :</label></td>
  <td width="541">Link : <input type="text" name="submittedVersionurl" size="30" required value="" /></td>
  <td width="252"><label for="file">Published Conference Paper :</label></td>
  <td width="541">Link : <input type="text" name="confPaperurl" size="30" required value=""/></td>
  <td width="252"><label for="file">Camera Ready Paper (full) :</label></td>
  <td width="541"><input type="file" name="file[]" id="cameraReady" onchange=checkFile(this) required value=""></td>
  <td width="252"><label for="file">Blind Paper (withour author info) :</label></td>
  <td width="541"><input type="file" name="file[]" id="blindPaper" onchange=checkFile(this) required value=""></td>
<input type="submit" value="Submit the form" align="center">

I hope I've provide sufficient info about my problem. Please help me starting from ..

Code: Select all

if (isset($_FILES['file']) && !empty($_FILES['file']))

:help: :help:

Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 2 guests