PDA

View Full Version : Upload an Image?


reteep
06-16-2011, 07:39 PM
Hi,

I'm using this code to upload an image to a specified path:

if (isset($_REQUEST['btn_upload'])) {
if (isset($_REQUEST['rb_format'])) {
$subfolder = $_POST['rb_format'];
}
else {
$err_msg = '<font color="#c00000"><b>Bitte Format des Banners angeben!</b></font><br />';
}

if ($err_msg != ''){
echo $err_msg;
}
else {
$vbulletin->input->clean_gpc("f","upload",TYPE_FILE);
require_once('./includes/class_upload.php');
require_once('./includes/class_image.php');
$upload = new vB_Upload_Image($vbulletin);
$upload->image =& vB_Image::fetch_library($vbulletin);
$upload->path = "./images/ads/".$subfolder."";
echo $upload->path;
if (!($upload->process_upload($vbulletin->GPC['upload']))){
eval(standard_error(fetch_error('there_were_errors _encountered_with_your_upload_x', $upload->fetch_error())));
}
}
}


However, it's always telling me the path would be incorrect. I tried different paths, even the root directory. Nothing helped. Also chmoded the "ads" path to 777, didn't help.

Any idea what could be wrong here?

Thanks a lot!