Jun
Error in php
change this
$filename = preg_replace(‘/[\\\/:*?”<>|]/’, ”, $filename);
Advice given: Put a \ before the colon, so it’s ‘/[\\\/\:
to
$filename = preg_replace('/[\\\/\:*?"<>|]/', '', $filename);
because I was getting this error(Below)
Warning: preg_replace() [function.preg-replace]: Unknown modifier ':' in /home/forbushj/public_html/uploadscript.php on line 31
Sorry, there was a problem uploading your file.
Now I am getting another error after doing this
the new error is:(Below)
Warning: preg_replace() [function.preg-replace]: Unknown modifier ‘\’ in /home/forbushj/public_html/uploadscript.php on line 31
Sorry, there was a problem uploading your file.
This is my complete script and I need some help getting rid of this error in the script
<?php
$uploaded_size = $_FILES[‘uploaded’][’size’];
$target = $filepath.$_FILES[‘uploaded’][‘name’];
$uploaded_type = $_FILES[‘uploaded’][‘type’];
$filepath = ‘/home/forbushj/www/vidtemp/’;
$filetypes = array(‘video/x-ms-asf’, ‘video/x-msvideo’, ‘video/x-flv’, ‘video/quicktime’, ‘video/mp4′, ‘video/mpeg’, ‘video/x-ms-wmv’);
$title = addslashes($_GET[‘title’]);
$descr = addslashes($_GET[‘descr’]);
$src = addslashes($_GET[’src’]);
// Check for errors:
if (addslashes($_GET[‘agree’] = 0))
{
echo(“You must agree or you can’t upload”);
}
else
{
if (!empty (
$title) || !empty ($descr) || !empty ($src) || !empty ($_FILES[‘uploaded’][‘tmp_name’])) {
if ($uploaded_size > 104857600) $error_msg .= ‘Your file is too large. Only files 100MB and less are allowed<br />’;
if (!in_array($uploaded_type, $filetypes)) $error_msg .= ‘You may only upload movies.<br />’;
if ($error_msg)
{
echo $error_msg . ‘Sorry your file was not uploaded’;
}
else if (move_uploaded_file($_FILES[‘uploaded’][‘tmp_name’], $target))
{
$file = $_FILES[‘uploaded’][‘tmp_name’];
$ext = substr($file, ((strrpos($file, ‘.’) !== false) ? strrpos($file, ‘.’) : strlen($file)), strlen($file));
$filename = date(‘Y-m-d-H-i-s’) . ‘_’ . str_replace(‘ ’, ‘_’, basename($file, $ext));
$filename = preg_replace(‘/[\\\/\:*?”<>|]/’, ”, $filename);
if (is_file($filepath . $file))
{
$output = array();
exec(‘ffmpeg -i ”‘ . escapeshellarg($file) . ‘” -an -ss 00:00:03 -t 00:00:01 -r 1 -y -s 150×100 -f mjpeg ”/home/forbushj/www/pic/video/’ . escapeshellarg($filename) . ‘.jpg”‘, $output, $exit_code_pic);
exec(‘ffmpeg -i ”‘ . escapeshellarg($file) . ‘” -ar 22050 -ab 32 -f flv -s 320×240 ”/home/forbushj/www/vidd/’ . escapeshellarg($filename) . ‘.flv”‘, $output, $exit_code_vid);
if (!is_array($output)) $error_msg = ‘Sorry, there was a problem uploading your file.’;
if ($exit_code)
{
error_log(‘ffmpeg exec returned ’ . $exit_code);
$error_msg = ‘Sorry, there was a problem uploading your file.’;
}
if (!$error_msg)
{
mysql_connect(“localhost”, “REMOVED”, “REMOVED”) or die(mysql_error());
mysql_query(“
INSET INTO forbushj_onetest.video (title, descr, pic, locat, src)
VALUES (
’” . mysql_real_escape_string($title) . “‘,
’” . mysql_real_escape_string($descr) . “‘,
’” . mysql_real_escape_string($filename . “.jpg”) . “‘,
’” . mysql_real_escape_string($filename . “.flv”) . “‘,
’” . mysql_real_escape_string($src) . “‘
)
”);
echo “upload successful”;
unlink(‘ . escapeshellarg($file) . ’);
}
}
else
{
$error_msg = ‘Sorry, there was a problem uploading your file.’;
}
}
else
{
$error_msg = ‘Sorry, there was a problem uploading your file.’;
}
if ($error_msg) echo $error_msg;
} else {
echo ‘You must fill out all fields!’;
}
}
?>
Help me if you can I am trying to get rid of the error.
30,000 Mb And Unlimited Bandwidth Only $3.75/mo.
Powered By: BigInfo.org
Relevant Links

