...

View Full Version : PHP and a little AJAX



badHabitZ
12-07-2010, 06:49 AM
Hey guys,

I am using the following (http://www.ajaxf1.com/product/ajax-file-upload.html) script to upload images on my website, and I have a few questions.


<?php

$destination_path = getcwd().DIRECTORY_SEPARATOR;

$result = 0;

$target_path = $destination_path . basename( $_FILES['myfile']['name']);

if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $target_path)) {
$result = 1;
}

include "config.php";

$filename = $_FILES['myfile']['name'];

$uploader = "update images set image='$filename' WHERE id='".$_REQUEST['id']."'";

mysql_query($uploader);

sleep(1);
?>

<script language="javascript" type="text/javascript">window.top.window.stopUpload(<?php echo $result; ?>);</script>

The above code handles the PHP stuff. I need to know how to actually change the name of the file that's being uploaded, not to a random name but to one that I enter myself. I only need to know the code that handles the changing, not the input, since I know how to do this. Can anyone help me with this?b

Thanks in advance!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum