Jump to content

File Upload - fill in the input field


daybase

Recommended Posts

I am very new to PHP so keep your hekp simple (like myself) please.  I have an application that I use for uploading up to 6 properties then resizing them - works great.  Now I need to deal with much larger uploads so I am looking for either a bulk upload solution or some way of pre-completing the input fields (like the value='cxcxcxc' on a normal text input) any idea

[code]

<?php

include('photostandards.inc');

include('photopages.inc');

session_start();

#$max_no_img=10; // Maximum number of images value to be set here

echo "<form method=post action=gallerydoit.php enctype='multipart/form-data'>";

echo "<table border='0' width='400' cellspacing='0' cellpadding='0' align=center>";

for($i=1; $i<=$max_no_img; $i++){

switch ($i) {

  case 1:

      echo "<tr><td>$px1 </td><td>";

      break;

  case 2:

      echo "<tr><td>$px2 </td><td>";

      break;

  case 3:

      echo "<tr><td>$px3 </td><td>";

      break;

case 4:

      echo "<tr><td>$px4 </td><td>";

      break;

case 5:

      echo "<tr><td>$px5 </td><td>";

      break;

case 6:

      echo "<tr><td>$px6 </td><td>";

      break;

}

 

echo"<input type=file name='images[]' class='bginput' size='30'></td></tr>"; #HERE - How do I pre-complete - value of each image $px5 px6 etc?

}

echo "<tr><td colspan=2 align=center><input type=submit value='Add Image'></td></tr>";

echo "</form> </table>";

?>

 

 

[/code]

Link to comment
https://forums.phpfreaks.com/topic/149274-file-upload-fill-in-the-input-field/
Share on other sites

You can't auto/pre complete a file element, its classed as a security risk.. it you could then using a few exploits could be you grab any file off of a clients pc..

 

Options:~ (goo but not easy)

Create an activeX or BHO that gets installed onto the clients browser,

Create a Java Applet that allows user to select files,

 

Or (simple option)

add simply add X number of file elements so they can upload more files at once.

 

ie

echo"<input type=file name='images[]' class='bginput' size='30'></td></tr>"; 
echo"<input type=file name='images[]' class='bginput' size='30'></td></tr>"; 
echo"<input type=file name='images[]' class='bginput' size='30'></td></tr>";
..

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.