StealthRT
StealthRT

Reputation: 10542

php rename before sending to sever

I'm trying to rename a file before it is uploaded and i dont seem to be doing it correctly...

$write_image($new_img, $new_file_path . '/', $options['upload_dir'] . 'HOME.jpg' . '/'), 100);

The new_file_path looks like so:

/home/content/h/e/f/xxx/html/admin/uploading/example/thumbnails/column.jpg/

And the $options['upload_dir'] . 'HOME.jpg' . '/' looks like so:

/home/content/h/e/f/xxx/html/admin/uploading/example/thumbnails/HOME.jpg/

It doesn't seem to work because it doesn't name the file and it gives me an error (like it was looking for the ordinal name and all)...

Any help would be great! :o)

David

Upvotes: 0

Views: 87

Answers (2)

StealthRT
StealthRT

Reputation: 10542

I corrected it by just doing

$write_image($new_img, $options['upload_dir'] . 'bob.jpg', 100);

David

Upvotes: 0

Rolando Cruz
Rolando Cruz

Reputation: 2784

Remove the trailing slash. They should be only present for directories and not files. And is the function call really supposed to start with a $?

And you have a syntax error. You have one extra closing parenthesis.

Upvotes: 2

Related Questions