fluvly Posted October 1, 2009 Share Posted October 1, 2009 I have a simple form which uploads a picture and updates different text fields onto a database. Everything is run locally, I haven't tried it on a real server yet. It looks like this: <form action="" method="post" enctype="multipart/form-data"> <label>Name</label> <input name="name" value="randname"/> <label>Intro</label> <textarea name="intro">Intro</textarea> <label>Main</label> <textarea name="main">Main</textarea> <img src="image.jpg" /> <input type="file" name="image"> <input name="submit" type="submit" value="Submit" /> <input name="submitted_edit" type="hidden" value="TRUE" /> </form> The database is then updated with the text fields, the image is copied to a separate folder and its path is written in the database. When I press the Submit button, the form reloads the same page over and over again, and if I change any of the text fields, each time they get updated on the database correctly. However, it does not work as spotlessly if, each time, I change the image field by selecting a new photo: when I press the Submit button over and over again, sometimes the page stalls, it doesn't go through and I can see in the status bar the text "contacting localhost". This happens totally randomly; sometimes the form goes through, the image path gets copied and updated, and the page reloads fine. Other times, as I already said, it stalls, and only by pressing the Submit button a second time I manage to make the form reload the page and do what it's supposed to do. It doesn't depend on the picture, since it happens also when I change the existing picture to the same picture: sometimes it works fine at the first try, other times it takes 2 clicks of the submit button to go through. Do any of you have any idea of what could cause this behaviour? It's driving me insane. Maybe the error is written to a log somewhere? Thanks in advance for any help. Quote Link to comment https://forums.phpfreaks.com/topic/176224-solved-form-with-image-upload-stalls-after-repeated-submits/ Share on other sites More sharing options...
TeNDoLLA Posted October 1, 2009 Share Posted October 1, 2009 Maybe the page is loading sometimes a longer time and when you press again the submit it gets loaded and submitted faster? Maybe something in your code is causing this or maybe there is something wrong with your local web server. In case it is caused by error, you could try looking into your php's and your web server's error logs and see if there is anything. Quote Link to comment https://forums.phpfreaks.com/topic/176224-solved-form-with-image-upload-stalls-after-repeated-submits/#findComment-928762 Share on other sites More sharing options...
fluvly Posted October 2, 2009 Author Share Posted October 2, 2009 Thanks for the reply. Could you tell me where to find the error logs? Quote Link to comment https://forums.phpfreaks.com/topic/176224-solved-form-with-image-upload-stalls-after-repeated-submits/#findComment-928952 Share on other sites More sharing options...
cags Posted October 2, 2009 Share Posted October 2, 2009 I think the default location is \apache\logs\error.log, I suspect this can be changed somewhere in the configuration settings, but assumably you'd know where to find it if you'd done that Quote Link to comment https://forums.phpfreaks.com/topic/176224-solved-form-with-image-upload-stalls-after-repeated-submits/#findComment-928974 Share on other sites More sharing options...
fluvly Posted October 2, 2009 Author Share Posted October 2, 2009 That's right, I wouldn't dream of changing its location. There's nothing in the error logs referring to what happens when it stalls - however, I have just tried using Firefox instead of Safari, and everything runs smoothly there. So I'll just wait until I upload everything to the server, and test it there. Thanks for all the help! Quote Link to comment https://forums.phpfreaks.com/topic/176224-solved-form-with-image-upload-stalls-after-repeated-submits/#findComment-928980 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.