No refresh upload file

Source: Internet
Author: User
Use PHP to make a feature that allows you to insert a picture when you post a message like most forums. Online check, input type= ' file ' is written in

In the form, when the form is submitted, the page updates automatically, and if you point the target to a hidden iframe, you can upload the text without a refresh.

Thing The file is able to upload successfully, but the problem occurs in the background generated file save path can not be updated in the current page. So

Can not be done like CSDN upload completed image after the corresponding path will be written in the edit box.

I wonder if there is any good way to solve the problem. I can't write now. Help.


Reply to discussion (solution)

Write the corresponding path in the edit box?
Can only be written to input type=text or other controls, but cannot be written to input type=file

IFrame needs to be named or have ID, receiver echo picture path
Use when retrieving
s = document.iframe name. Document.body.innerHTML
ID is similar

Write the corresponding path in the edit box?
Can only be written to input type=text or other controls, but cannot be written to input type=file

IFrame needs to be named or have ID, receiver echo picture path
Use when retrieving
s = document.iframe name. Document.body.innerHTML
ID is similar



I am like this: When the form is submitted, the background handler is submitted to the IFRAME as $this->filepath = (corresponding to the generated pathname) and then document.getElementById in the page ( "IFrame"). The form of InnerHTML gets back data from the background. But it's always impossible to get data. As if the IFRAME can't be synchronized

Quote= Reference 1 Floor xuzuning's reply:]
Write the corresponding path in the edit box?
Can only be written to input type=text or other controls, but cannot be written to input type=file

IFrame needs to be named or have ID, receiver echo picture path
Use when retrieving
s = document.iframe name. Document.body.innerHTML
ID is similar

About the program like this.

HTML inside daemon function newtopic () {   if (//have file) {      //upload file Return file path       $this->path = File save path              echo ""// It is here that the path is empty, as if it had not been updated.   }}

function GetPath () {
document.getElementById ("Ifram"). InnerHTML;
}


Where did you get the id= ' Ifram '
What about the functions called in the IFRAME, or the IFRAME as a benchmark?

Furthermore, there is no solution to the problem of getting the cursor position under IE. can only be normal under the WebKit browser. I tested the csdn, too.

Furthermore, there is no solution to the problem of getting the cursor position under IE. can only be normal under the WebKit browser. I tested the csdn, too.

Where did you get the cursor position?

Reference to the 6 floor xjl756425616 reply: And about getting the cursor position problem, under IE is no solution. can only be normal under the WebKit browser. I tested the csdn, too. Where did you get the cursor position?


It seems that the moderators have not done the editor Wow ~
After submitting to a hidden field, the image is uploaded, and the whole process is not refreshed, yes
But you have to return the address of the picture to textarea, for example,
11111111
The cursor click here, then to upload pictures, WebKit can do, the picture shows in this position,
But IE, when processing the picture, will lose the cursor focus, the picture can not be shown here
2222222

It is true: the ignorant is fearless

IMG.MY.CSDN.NET/UPLOADS/201303/16/1363434181_6561.JPG][/IMG]

function GetPath () {
document.getElementById ("Ifram"). InnerHTML;
}


Where did you get the id= ' Ifram '
Not to mention the function called in the IFRAME, or to Ifram ...



The leak ..... I'll try again.

Furthermore, there is no solution to the problem of getting the cursor position under IE. can only be normal under the WebKit browser. I tested the csdn, too.



I thought about it, but I didn't write that place and stuck it in the uploading section.
What I do now is to return the address of the image to the textarea, and there are other ways to do it.

It is true: the ignorant is fearless


Do not go through the investigation, not so quick to make a conclusion ~ you can see
C:\Documents and settings\administrator\ Desktop \youyax_v12_utf8\org\ubb\org\ubb\uploadforeditor.class.php
The 41st line starts, I can only put the picture in the last place under IE
Tried to use cookies and the like, only more and more chaotic, the Internet to find a lot of information ~ including some people have mentioned similar problems ~
The cursor disappears under IE,
Do not believe you use IE browser to try csdn image upload function ~
See if I'm telling the truth ~

As long as you are not behind closed doors, carefully extract the opinions of others. How come there is such a conclusion?
Http://www.baidu.com/baidu?word=%E5%85%89%E6%A0%87%E5%A4%84%E6%8F%92%E5%85%A5&ie=utf-8

This is the code I wanted before (ie dedicated)

  

This post was last edited by xuzuning on 2013-03-16 21:13:41
As long as you are not behind closed doors, carefully extract the opinions of others. How come there is such a conclusion?
Http://www.baidu.com/baidu?word=%E5%85%89%E6%A0%87%E5%A4%84%E6%8F%92%E5%85%A5&ie=utf-8

This is my ...



Because you have not done a web editor, so I and the landlord thought possible moderator you do not understand ~
Your code does, because in IE, your cursor position does not disappear.
The so-called disappearance of the cursor, in fact, refers to the disappearance of the text selected object.
A cursor clicked in one place, or a piece of text is selected, an object is created
Document.selection.createRange () under IE
WebKit, the location information SelectionStart and Selectionend are displayed.
When the upload dialog box pops up When submitted to a hidden field, the image is processed by a PHP file,
The Parent.document.selection.createRange () under IE is empty, meaning the cursor disappears.
and WebKit, SelectionStart and selectionend still have values, so they can be plugged into the mouse-clicked position.
You just have to do a bit to understand ~ or you try to visit csdn under IE, upload pictures to see if there is a problem ~

As to why it will disappear, perhaps the browser mechanism problem, pop-up dialog box, then not the mouse can not click anywhere? Just like the pop-up alert ~

I'm not particularly sure if that's the reason, it's best if someone can make it.

Reference 13 Floor Xuzuning's reply:
This post was last edited by xuzuning on 2013-03-16 21:13:41
As long as you are not behind closed doors, carefully extract the opinions of others. How come there is such a conclusion?
Http://www.baidu.com/baidu?word=%E5%85%89%E6%A0%87%E5%A4%84%E6%8F%92%E5%85%A5&ie=ut ...



Do here, it is true, in the background program run up when it really loses focus, if not re-upload the location of no problem

Come on, make a plan.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.