Skip to content
Advertisement

Issue with uploading image using this.form.submit();

I am using this.form.submit(); in order to upload an image straight after it is sellected and also pass some other info along.

I am having an issue, the submit works and passes the id with post but the image is not uploaded and the name is not inserted in the db it might add a name like 0_ but that is incorrect as well as the image name does not exist in the table so it should pass the if(file_exists) without any loops.

Any ideas on that?

And the php code is the following:

Advertisement

Answer

It really was something stupid that I didn’t see as I mentioned in my comment above… If you check closely the if(file_exists) you can see that the stmt is inside it and well… there wasn’t an else to upload so if an image was unique nothing happened so I just coppied the move_uploaded_file and the rest and added an else{ and that fixed the issue.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement