Hi,
I'm trying to make my upload script automatically upload to a certain folder based on the file extension. e.g.: jpg files to upload to the "jpg" folder, zip files to upload to the "zip" folder, etc.
Currently I have it working that it uploads to a folder that the user selects, but if the user selects the wrong folder, then its more maintenance I have to deal with.
Here is the current code:
<form id="UploadForm" action="index.php" method="post" enctype="multipart/form-data">
<div>
<h1>Select your files</h1>
{loop name=i var=$upload_fields}<strong>{$upload_fields[i]}</strong>.
<input type="file" name="file{$upload_fields[i]}" size="70" style="margin-bottom: 3px"/>
<br />
{/loop} <br />
____
<input type="image" src="images/upload.gif" name="action[doupload]" />
</div>
<div> <br />
<h1>Upload options</h1>
Upload into: <strong id="selected_destination">Maps</strong><br />
<select name="destination" cols="50" id="destination" onchange="document.getElementById('selected_destination').innerHTML = this.value;">
{loop name=j var=$incoming_directories}
<option value="{$incoming_directories[j]}">{$incoming_directories[j]}</option>
{/loop}
</select>
<br />
<br />
above where you see the "Upload into:" thats where you have the select. I would like it to just upload based on "if{ext == .jpg} 'upload into JPG directory'"
I've searched for examples here but didn't quite find any.