$file_safe_name

See all posts Reply

$file_safe_name new!
by Kokolo, 15 years, 8 months ago
Is it possible to echo $file_safe_name variable?

This isn't working:
echo $handle->file_safe_name;

And this also:
echo $file_safe_name;

This is the original code:
$handle = new upload($_FILES['image_field']);
if ($handle->uploaded) {
  $handle->file_new_name_body   = $_POST['date'] . $_POST['title'];
  $handle->image_resize         = true;
  $handle->image_x              = 100;
  $handle->image_ratio_y        = true;
  $handle->process('images/');
  if ($handle->processed) {
    echo $_POST['date'] . $_POST['title'];
    echo $handle->file_safe_name;
    echo "OK";
    $handle->clean();
  } else {
    echo 'error : ' . $handle->error;
  }
}
Reply
Re: $file_safe_name new!
by colin, 15 years, 8 months ago
file_safe_name is only a boolean flag; why would you want to output it?

Are you sure you are not looking for file_dst_name?Reply
Re: $file_safe_name new!
by kokolo, 15 years, 8 months ago
Yes, to echo the right value I need to use:
echo $handle->file_dst_name;

Thanx colin!

P.S. I want to use this value in order to create a link to the image. The name of the image is dynamic because it depends on the date when it is submitted and the title of the text that it refers to.
$handle->file_new_name_body = $_POST['date'] . $_POST['title'];

Means that the name of the image is TodaysDateTitleOfTheText.extension

And the link to the image will be /images/TodaysDateTitleOfTheText.extension and that is equal to /images/$handle->file_new_name_bodyReply