Jump to content

Changing the name of file uploaded adds up Array to the name


ChrisPHP

Recommended Posts

Hello everyone,

 

Hope you're doing all fine :)

 

I just wanted to ask about something that's happening to me recently..

Whenever I change the name of a file, it automatically adds up Array in the beginning of the name.

I just wanted to know if there's a way to prevent it

 

I'm using

 

$target = $target . basename($_FILES['AImage']. $an .'.jpg');

 

where AImage is the name of the field in mysql and $an is the name that I wanted to put

 

 

Thanks in advance.

Best regards,

Chris

Just for comprehension.. what does array_shift() actually do?

 

From the manual:

 

array_shift() shifts the first value of the array off and returns it, shortening the array by one element and moving everything down.

 

So if you do the following:

 

$companies = array('Microsoft', 'Google', 'Apple');
$removed_company = array_shift($companies);

 

Then $companies will only contain "Google" and "Apple", and $removed_company will contain "Microsoft".

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.