that did not help (I probably messed up) but I changed the name of the submit button to upload (When I use the onChange event, It doesn't seem to find the $_POST['upload'] variable http://fixmysite.us/asp/providers/test1.php
I have this if statement in upload.processor.php
PHP Code:
// check the upload form was actually submitted else print the form
isset($_POST['upload'])
or error('the upload form is neaded', $uploadForm);
But seems to see it if the submit button is clicked here http://fixmysite.us/asp/providers/test.php
Is that right? why doesnt the event act as if the submit button is clicked?
Let me explain what I'm trying to do as you might have a better way for me to do this...
I'm trying to upload an image the moment the onchange event is triggered so that the image in thumbnail size appears so that the upload is confirmed to the stupid, also how can this be done without refreshing the page as ill have another form on the page I dont want to reset?
Thanks a lot...
I'm a deer hunter. I go all the time with my dad. One thing about deer, they have very good vision. One thing about me...I am better at hiding than they are at vision.
I'm trying to upload an image the moment the onchange event is triggered so that the image in thumbnail size appears so that the upload is confirmed to the stupid, also how can this be done without refreshing the page as ill have another form on the page I dont want to reset?
Thanks a lot...
That's a Javascript issue. You could do it like vBulletin, i.e. do the upload in a separate window.
Hi, I was wondering if you could help me please? I've created a very basic CMS and would like to allow the site's administrator to upload some pre-named images eg. image1.jpg, image2.jpg. They then need to be able to add them to pages using a form. I've set all of this up and they can add text with no problems. I would like them to be able to insert images into the pages by using <img src="image1.jpg" /> etc but this won't work due to the long string of numbers added to the image, as referred to in post #68. From reading further posts I understand that this relates to the date and time of upload and comes from the following lines of code:
// make a unique filename for the uploaded file and check it is
// not taken... if it is keep trying until we find a vacant one
$now = time();
while(file_exists($uploadFilename = $uploadsDirectory.$now.'-'.$_FILES[$fieldname]['name']))
{
$now++;
}
// now let's move the file to its final and allocate it with the new filename
@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename)
or error('receiving directory insuffiecient permission', $uploadForm);
Now, I am a complete numpty at php and was wondering if you could please tell me EXACTLY what code I need to remove (or add) to fix the issue as I can't figure this out myself? I have tried and it's probably very simple and obvious when you know what you're doing but I can't get it to work.
Many thanks
// now let's move the file to its final and allocate it with the new filename
@move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename)
or error('receiving directory insuffiecient permission', $uploadForm);
That code was just an example of one way to name a file so there weren't collisions. If you want to call a file something specific just write it into your code.
Thanks for the response, but it's not quite what I meant. Sorry, I probably didn't explain it very well. I don't want to rename the file with the php code, I just want it to upload with exactly the same name it has when the user browses to it and selects it for upload, whatever that name will be. I don't wish to change that name, I just want the user to know what name to refer to when they enter <img src="...... .jpg" /> to add the image in a page.
Using your original method, which adds a long string of numbers before the image name, there is no way of knowing how to reference that image. I just want the user to be able to upload any files they wish and keep their original names. Is this possible?
Thanks.
I forgot to mention that they won't be able to access the folder on the server to find the new file name, which is why it's such an issue to alter the name.
I forgot to mention that they won't be able to access the folder on the server to find the new file name, which is why it's such an issue to alter the name.
Allowing people to decide the file name is a major security risk.
It's okay, I just need to do this for a college project and the site won't go live so security is not going to be an issue in this case. I just need to be able to show that a user can upload an image to a folder and insert it into a page. The only way I can do it with the CMS I have is if the file name remains the same after upload so that the administrator can easily make a reference to it without having to access the files on the server. I'd really appreciate it if you could show me how to do this please? I won't be hand-coding any websites with PHP in the future, I'll use something like Wordpress or Joomla as I find PHP too complicated.
Cheers!
You are amazing and I have successfully set up using your codes etc but don' t know anything about coding with php.
When I receive the email notification I need the following details to be in the email
1. The name of the image the user uploaded - (with the renaming)
2. Preferably the url of the image
3. the details of the form that the person had filled out eg: name, address, email address etc. I'm sort of stuck in how to add those details to the actual html form so the php can read those fields
4. would also love to email the person automatically with confirmation
I really hope you can help me. I haven't changed the code at all, it's exactly as on the sticky so I won't bother posting it here. I have googled this question and read through all 22 pages but still not sure how to get what I need. thanks
Bookmarks