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

Link to comment
Share on other sites

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".

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.