Storing URL of an uploaded file into SQL database
Posted: Wed Feb 06, 2008 3:20 am
Hi all,
I'm trying to allow my users to upload a file, the URL of which is stored into my SQL database. Here is what I have so far:
<form enctype="multipart/form-data" id="oefenstof_upload" name="oefenstof_upload" method="POST" action="
<?php
echo $editFormAction;
$target_path = "_files/oefenstof/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path);
?>">
<input name="oefenstof_uploadedby" type="hidden" value="<?php echo $slusername ?>" />
<input name="oefenstof_date" type="hidden" value="<?php echo date("Y-m-d") ?>" />
<input name="oefenstof_url" type="hidden" value="<?php echo $target_path ?>" />
<input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
Kies een bestand om te uploaden:
<input name="uploadedfile" type="file" /><br />
Geef dit bestand een titel:
<input name="oefenstof_title" type="text" /><br />
<input type="submit" value="Bestand uploaden" />
<input type="hidden" name="MM_insert" value="oefenstof_upload" />
</form>
</p>
The writing into the database is handled elsewhere on the page. However, I can get the correct URL, but I cannot get the filename into my database. Could you please tell me how I could do this?
Thanks,
Frank
I'm trying to allow my users to upload a file, the URL of which is stored into my SQL database. Here is what I have so far:
<form enctype="multipart/form-data" id="oefenstof_upload" name="oefenstof_upload" method="POST" action="
<?php
echo $editFormAction;
$target_path = "_files/oefenstof/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path);
?>">
<input name="oefenstof_uploadedby" type="hidden" value="<?php echo $slusername ?>" />
<input name="oefenstof_date" type="hidden" value="<?php echo date("Y-m-d") ?>" />
<input name="oefenstof_url" type="hidden" value="<?php echo $target_path ?>" />
<input type="hidden" name="MAX_FILE_SIZE" value="2000000" />
Kies een bestand om te uploaden:
<input name="uploadedfile" type="file" /><br />
Geef dit bestand een titel:
<input name="oefenstof_title" type="text" /><br />
<input type="submit" value="Bestand uploaden" />
<input type="hidden" name="MM_insert" value="oefenstof_upload" />
</form>
</p>
The writing into the database is handled elsewhere on the page. However, I can get the correct URL, but I cannot get the filename into my database. Could you please tell me how I could do this?
Thanks,
Frank