Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Looking for a solution to sync or otherwise an image folder that is uploaded to by clients in a Staging server and mirrored or copied to the Production website.

Posted on 2014-11-11
4
Medium Priority
?
254 Views
Last Modified: 2014-12-17
Hello Experts,

I have a client that uploads blog images via the DMZ in a STAGING server ( using an ASP Upload DMX plugin ) however I would like that folder mirrored to the PRODUCTION website.

In order for me let the, use the form to upload to the STAGING server , I had to give that Internet Account in Security to modify so that it can upload the images.
Of course I cannot give the Internet account on the PRODUCTION website anything more than read.
Thus my dilemma.
I am not a wizard so any viable solution would be greatly appreciated!

Thank you in advance,

Using ASP Classic, VBScript, Windows 2008 Server , both servers are in the DMZ with the same domain.
0
Comment
Question by:colonelblue
4 Comments
 
LVL 2

Expert Comment

by:Glen Richmond
ID: 40436835
can you give a specific application special permission and write your own sync app (ASP.Net/C#/VB.Net?) to run in the background (CGI?) being called everytime a file is copied to the STAGING area to copy to the PRODUCTION area?
0
 

Author Comment

by:colonelblue
ID: 40438474
:( As I'm mentioned , I'm not a wizard,
0
 
LVL 34

Expert Comment

by:Big Monty
ID: 40440141
Of course I cannot give the Internet account on the PRODUCTION website anything more than read.

makes sense. what about creating a different internet account that has read/write access ONLY on this particular site? or are you uncomfortable giving ANY account that kind of access?

if that's the case, you may better off writing a vbs script that runs under Scheduled Tasks, and does that file transfer directly that way
0
 
LVL 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 2000 total points
ID: 40441798
Why not just run it as a vbscript (save the file as a .vbs) and have your scheduled task run on the production server.

Taking the save example from http://www.webresizer.com/app/demos/code/asp.html
imagename = request("fileName")
url = request("url")
 
'Creating variables
 
imageUrl = url 
strImageName = imagename
 
'Function and subroutine calls
 
saveImage getImage(imageUrl), strImageName
 
'Here is code library:
 
Function getImage(strImageUrl)

  ' Set objHttp = CreateObject("Microsoft.XMLHTTP")
  ' Set objHttp = CreateObject("MSXML2.ServerXMLHTTP")
  Set objHttp = CreateObject("WinHttp.WinHttpRequest.5.1")
  ' Set Http = CreateObject("WinHttp.WinHttpRequest")
  objHttp.Open "GET", strImageUrl, False
  objHttp.Send
            
  getImage = objHttp.ResponseBody

End Function
 

Sub saveImage(ByteArray, strImageName)

  Const adTypeBinary = 1
  Const adSaveCreateOverWrite = 2
  Const adSaveCreateNotExist = 1
            
  Set objBinaryStream = CreateObject("ADODB.Stream")
  objBinaryStream.Type = adTypeBinary
            
  objBinaryStream.Open
  objBinaryStream.Write ByteArray
  objBinaryStream.SaveToFile server.mappath("images\" & strImageName) , 
      adSaveCreateOverWrite
  response.Write("Image has been downloaded and saved!")

end sub

Open in new window


On the production server, you just need to read which files are available, then  loop through those files, read the url where they are from and save.    Running this as a vbs file means you don't have to give permissions to the internet user account

For the first part, you need to read what is available.  Your upload script on the staging server can generate a file that lists the urls of images.  If you want to add a little security to that page.
if request.querystring("passcode")="some_long_pass_code" then
    response.write "<img src='/images/someimage.jpg'>"
    response.write "<img src='/images/someimage.jpg'>"
end if

Open in new window

That will list the images on the staging server.  Then you can loop through the images and save them using the first bit of code with some modification of course.

Check out aspupload http://www.aspupload.com/manual_security.html there is a way where you can set a password on a folder and aspupload can submit that info.


Why make it difficult for yourself.  Why not make one folder on the production server able to accept an image from your image upload simultaneously.   You can set an obscure folder with the write permissions, then once there, use fso to move it to the images folder.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I still run into .cgi files every now and then. In some instances, I actually prefer the simplicity of a .cgi script to other options. Since I use DreamWeaver extensively, what I needed was a way to open .cgi scripts in Dreamweaver. And I wanted to …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question