[Solved] Uploading not obviously related to Sketchup
-
@thomthom said:
I'm not sure why you don't get an index for the uploaded file. By first glance it looks ok. This is why I wonder if it's your JS wrapper interfering. The wrapper is the first thing I noticed that deviate from the basic example in the PHP manual: http://www.php.net/manual/en/features.file-upload.post-method.php
Are you sure the JS wrapper can be used as the target of POST commands? Not just regular POST, but also these file variants?I'd try to make a regular HTML form with
action
pointing directly to the PHP file.Sorry not to respond. I don't get notifications any more although I checked with Gaieus that all my settings are correct. But of course I appreciate your help and want to get this going asap.
I am now reading the php manual. I was using some tutorials before. The thing about a direct link to a php file was that it is opened in the browser - that's the part I really don't get ... or want.
Thanks
-
@chrisglasier said:
The thing about a direct link to a php file was that it is opened in the browser - that's the part I really don't get ... or want.
As you're doing it now you're directing the form to a JS - I'm just not sure if form file uploads works then. I'm suggesting trying without the wrapper just to verify that everything else is working. That way we know for sure if it's the JS wrapper interfering or not.
-
Yes I can make it work with a php file. I used a history.back[-1] in an embedded js script. That was OK but then I could not call the js that parses the json file and either reports a failure or incorporates the new file contents.
-
So it sounds like it's the JS wrapper that can't be the target for file POSTs. I'm completely unfamiliar with that wrapper so I can't help much there.
Can you avoid the use of
history.back[-1]
? -
@thomthom said:
So it sounds like it's the JS wrapper that can't be the target for file POSTs. I'm completely unfamiliar with that wrapper so I can't help much there.
Can you avoid the use of
history.back[-1]
?That's what I want. Am I right that
action = "xxx.php"
has to open that file in the browser? I think this is what I don't understand. And I am quite happy to lose the js wrapper (I didn't know it was one!)Thanks ... again
-
A form POST goes to another file - the file you put in
action=""
- which in your above example pointed to a javacript (action="javascript:phpOwnerFile();"
). And that's the reason it didn't work because a POST was never sent.Your PHP snipped needs to be the target of
action
. And that will cause the page to navigate. -
@thomthom said:
...
Your PHP snipped needs to be the target of
action
. And that will cause the page to navigate.Perhaps I should open a popup window for all this but I would prefer not to if there is another solution. I am just finishing off a mock version for my site. If you have time later perhaps you would have a look, click on owner and get a better idea of what I am trying to achieve.
Thanks.
-
You could try to route the action to an hidden iframe. Similar to what this guy is doing: http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html
-
@thomthom said:
You could try to route the action to an hidden iframe. Similar to what this guy is doing: http://www.ajaxf1.com/tutorial/ajax-file-upload-tutorial.html
Thanks I will have a go with that.
Meanwhile I've uploaded the files to the site.
-
First read through that seems perfect. I think I even understand it! Will try out tomorrow.
Many thanks
-
Yes it works just fine.
Soon people who visit my site will be able to make and save an "ownerfile". When they return they can upload the file to work with all the named links, keys, functions, value options and config settings previously set. This will also be extended to upload shared project or activity files (later including Sketchup of course).
This is why the uploading business is so important in this context and why your pointer was much appreciated.
Many thanks,
Chris
Advertisement