Invision Power Board -> globalTemplate:
<script language="javascript" type="text/javascript">
<!--
function startUpload(){
document.getElementById('myf1_upload_process').style.visibility = 'visible';
document.getElementById('myf1_upload_form').style.visibility = 'hidden';
return true;
}
function stopUpload(success){
var result = '';
if (success == 1){
result = '<span class="mymsg">The file was uploaded successfully!<\/span>';
}
else {
result = '<span class="myemsg">There was an error during file upload!<\/span>';
}
document.getElementById('myf1_upload_process').style.visibility = 'hidden';
document.getElementById('myf1_upload_form').innerHTML = result + '<br/>File: <input name="myfile" type="file" size="0" /><input type="submit" name="submitBtn" class="mysbtn" value="Upload" />';
document.getElementById('myf1_upload_form').style.visibility = 'visible';
return true;
}
//-->
</script>
upload.php
<?php
// Edit upload location here
$destination_path = getcwd().DIRECTORY_SEPARATOR;
$result = 0;
$target_path = $destination_path . basename( $_FILES['myfile']['name']);
$imagetypes = array(
'image/png' => '.png',
'image/gif' => '.gif',
'image/jpeg' => '.jpg',
'image/bmp' => '.bmp');
$ext = $imagetypes[$_FILES['myfile']['type']];
$randval = time();
$newname = $randval . $ext;
if(@move_uploaded_file($_FILES['myfile']['tmp_name'], $newname)) {
$result = 1;
}
sleep(1);
?>
<script language="javascript" type="text/javascript">window.top.window.stopUpload(<?php echo $result; ?>);</script>
<form action="myuploader/upload.php" method="post" enctype="multipart/form-data" target="upload_target" onsubmit="startUpload();" >
<div style="margin-top:-40px">
<p id="myf1_upload_process"><strong>UpLoading...</strong>
<br/>
<img src="myuploader/loader.gif" />
<br/>
</p>
<p id="myf1_upload_form" align="left">
<br/>
File: <input type="file" name="myfile" accept="image/*" size="0" />
<input type="submit" name="submitBtn" class="mysbtn" value="Upload" />
</p>
</div>
<iframe id="upload_target" name="upload_target" src="#" style="width:0;height:0;border:0px solid #fff;"></iframe>
</form>
editor = ipb.textEditor.getEditor(ipb.topic.fastReplyId);
Как сделать так,чтобы после завершения загрузки ссылка на фото которую загрузили автоматически вставилос в editor editor = ipb.textEditor.getEditor(ipb.topic.fastReplyId); в тегах
---------------------------------------------------------------------------------------
или ...
<script language="javascript" type="text/javascript">
<!--
function startUpload(){
document.getElementById('myf1_upload_process').sty le.visibility = 'visible';
document.getElementById('myf1_upload_form').style. visibility = 'hidden';
return true;
}
function stopUpload(success){
var result = '';
if (success == 1){
result = '<span class="mymsg">The file was uploaded successfully!<\/span>';
}
else {
result = '<span class="myemsg">There was an error during file upload!<\/span>';
}
document.getElementById('myf1_upload_process').sty le.visibility = 'hidden';
document.getElementById('myf1_upload_form').innerH TML = result + '<br/>File: <input name="myfile" type="file" size="0" /><input type="submit" name="submitBtn" class="mysbtn" value="Upload" />';
document.getElementById('myf1_upload_form').style. visibility = 'visible';
return true;
}
//-->
</script>
подскажите как выводит вместо него, или в нем:
result = '<span class="mymsg">The file was uploaded successfully!<\/span>';
это:
(вы лучше знайте: хочу чтоб выводилось ссылка на загружаемого файла):
echo "Адрес <a href=\"myuploader/$new_name\">http://my_site_url/myuploader/$newname</a>";