You are not logged in.
Pages: 1
I am trying to convert over from an old version of htmlarea, but there doesn't seem to be any image upload functionality add-ons for Xinha. Does anyone have any ASP image upload scripts I can grab that will integrate with XInha?
THanks!
Offline
Or, is there some easy way to change the image upload on xinha to work with my old upload script?
Offline
I use image uploading with Xinha, almost exactly the way I used it with htmlarea.
There are a few things I needed to do in order to make it work properly so I will list them below:
Convert htmlarea.js to htmlarea.asp and convert popups/insert_image.html to popups/insert_image.asp
I pass an object_ref via querystring through htmlarea.asp?object_ref=adfasf to popups/insert_image.asp at about line 2830 (search for "insert_image.html" to change to "insert_image.asp?object_ref=adfasf" in the _popupDialog function) so I know which uploaded image belongs to which object (objects might be news articles or pages etc)
Then at the top of popups/insert_image.asp I use this code (below is slightly edited for your ease of reading) that used the Software Artisans FileUpload utility - which can be replaced by whichever upload tool you have available. Note that if you don't use SA FileUpload you might not be able to use the progress bar indicator (which uses another page called progress.asp - let me know if you want the code for that page too).
<fieldset style="float: left; margin-left: 5px; margin-right: 50px; width: 95%">
<legend>Upload</legend>
<div class="space"></div>
<%
Dim uplp, progress_id
Set uplp = Server.CreateObject("Softartisans.FileUpProgress")
progress_id = uplp.NextProgressID
%>
<script language='JavaScript'><!--
function ftnSetPic(picture_ref)
{
document.getElementById("f_url").value = "http://<%= Request.ServerVariables("SERVER_NAME") & ":" & Request.ServerVariables("SERVER_PORT") %>/file_library/file.asp?file_ref=" + picture_ref
}
function openprogress()
{
window.open("/file_library/progress.asp?progress_id=<%= progress_id%>",null,"height=100,width=400,status=no,toolbar=no,menubar=no,location=no");
}
//--></script>
<form name="frmPicture" action="picture_upload.asp?progress_id=<%= progress_id %>" enctype="multipart/form-data" method="post" onSubmit="openprogress()">
<tr>
<td style="width: 7em; text-align: right">New Picture:</td>
<td>
<input type="file" name="picture">
<input type="hidden" name="object_ref" value="<%= object_ref %>">
<input type="submit" name="action" value="Upload">
</td>
</tr>
</form>
<br />
<%
Dim rst_Get_Pictures
' insert code here to get any pictures already uploaded - from database, filesystem etc
If Not rst_Get_Pictures.EOF Then
%>
<table width="90%">
<th align='left'>Uploaded Pictures:</th>
<%
Do While Not rst_Get_Pictures.EOF
%>
<tr><td><a href="javascript: ftnSetPic('<%= rst_Get_Pictures("file_ref")%>')"><%= rst_Get_Pictures("file_name") %></a></td></tr>
<%
rst_Get_Pictures.MoveNext
Loop
%>
</table>
<%
Else
Response.Write("<div align='center'>No pictures uploaded yet<br /><br /></div>" & vbCrLf)
End If
%>
</fieldset>
Basically through the ftnSetPic() function the "value" of the picture source is sent to the existing form field on the existing inset_image.asp page so the "Preview" still works and the inserted picture actually refers to a page designed to display the picture (my pictures must all be displayed through file.asp as they are stored in a non-public area on the server - you could quite easily make these point to pictures stored publicly though). Note the Request.ServerVariables("SERVER_NAME") used to make sure the absolute path is sent as the picture source as I don't use the my_config.baseHref = "mydomain" as I use X-Area on many sites and don't want to keep changing it. Relative paths don't work with images on Xinha if you don't specify the baseHref properly.
And thats it! let me know if you have any problems with this and I will be happy to reply.
akaEdge
Offline
hi..can i know the simple photo upload function? which is for gallery one..
Offline
Pages: 1