سروي كه بتواند آپلود كند بايد

سلام
ببخشيد مي خواستم ببينم سروري كه بتواند فايل آپلود كند بايد داراي چه خصوصياتي باشد؟

و من اگر بخواهم صفحه اي را كه با asp ساختم برای آپلود کردن عکس روی کامپیوتر خودم اجرا کنم نیاز به چه برنامه هایی دارم


با تشکر
 
amirasal2002 گفت:
سلام
ببخشيد مي خواستم ببينم سروري كه بتواند فايل آپلود كند بايد داراي چه خصوصياتي باشد؟

و من اگر بخواهم صفحه اي را كه با asp ساختم برای آپلود کردن عکس روی کامپیوتر خودم اجرا کنم نیاز به چه برنامه هایی دارم


با تشکر
ببخشيد مثل اينكه من خوب توضيح ندادم
ببينيد من يك صفحه با asp طراحي كردم كه به كاربر اجازه مي دهد عكس خود را به سايت بفرستد يعني همان آپلود كردن
خوب حالا مي خواستم ببينم سروري كه بتواند اين صفحه را ساپورت كند بايد داراي چه خصوصياتي باشد و چه برنامه هايي بر روي آن نصب شده باشه
و اگر من بخواهم اين برنامه را روي كامپيوتر خودم اجرا كنم به جز نصب iis آيا نياز به برنامه ديگري دارم يا خير
 
ممنون كه جواب داديد
من اين سايت را پيدا كردم ببينيد چطوري ميشه از قسمت aspSmartUpload براي كار من استفاده كرد البته اگه زحمتي نيست يعن اصلا كار aspSmartUpload چي است
http://www.aspsmart.com
 

hoom

Active Member
سلام

من يادم نمياد جواب اين سوال رو تا حالا چند بار داده‌ام ولي اميدوارم اين آخرين بار باشه. اين قسمت رو با اسم Loader.asp ذخيره كننين :

کد:
<%
 Session.CodePage = 1252
 Session.LCID = 2057
 Response.CharSet = "Windows-1252"

        Class Loader
                Private dict
                
                Private Sub Class_Initialize
                        Set dict = Server.CreateObject("Scripting.Dictionary")
                End Sub
                
                Private Sub Class_Terminate
                        If IsObject(intDict) Then
                                intDict.RemoveAll
                                Set intDict = Nothing
                        End If
                        If IsObject(dict) Then
                                dict.RemoveAll
                                Set dict = Nothing
                        End If
                End Sub

                Public Property Get Count
                        Count = dict.Count
                End Property

                Public Sub Initialize
                        If Request.TotalBytes > 0 Then
                                Dim binData
                                        binData = Request.BinaryRead(Request.TotalBytes)
                                        getData binData
                        End If
                End Sub
                
                Public Function getFileData(name)
                        If dict.Exists(name) Then
                                getFileData = dict(name).Item("Value")
                                Else
                                getFileData = ""
                        End If
                End Function

                Public Function getValue(name)
                        Dim gv
                        If dict.Exists(name) Then
                                gv = CStr(dict(name).Item("Value"))
                                
                                gv = Left(gv,Len(gv)-2)
                                getValue = gv
                        Else
                                getValue = ""
                        End If
                End Function
                
                Public Function saveToFile(name, path)
                        If dict.Exists(name) Then
                                Dim temp
                                        temp = dict(name).Item("Value")
                                Dim fso
                                Set fso = Server.CreateObject("Scripting.FileSystemObject")
                                Dim file
                                        Set file = fso.CreateTextFile(path, True, False)
                                                For tPoint = 1 to LenB(temp)
                                                  file.write Chr(AscB(MidB(temp,tPoint,1)))
                                                Next
                                                file.Close
                                        saveToFile = True
                        Else
                                        saveToFile = False
                        End If
                End Function
                
                Public Function getFileName(name)
                        If dict.Exists(name) Then
                                Dim temp, tempPos
                                        temp = dict(name).Item("FileName")
                                        tempPos = 1 + InStrRev(temp, "\")
                                        getFileName = Mid(temp, tempPos)
                        Else
                                getFileName = ""
                        End If
                End Function
                
                Public Function getFilePath(name)
                        If dict.Exists(name) Then
                                Dim temp, tempPos
                                        temp = dict(name).Item("FileName")
                                        tempPos = InStrRev(temp, "\")
                                        getFilePath = Mid(temp, 1, tempPos)
                        Else
                                getFilePath = ""
                        End If
                End Function
                
                Public Function getFilePathComplete(name)
                        If dict.Exists(name) Then
                                getFilePathComplete = dict(name).Item("FileName")
                        Else
                                getFilePathComplete = ""
                        End If
                End Function

                Public Function getFileSize(name)
                        If dict.Exists(name) Then
                                getFileSize = LenB(dict(name).Item("Value"))
                        Else
                                getFileSize = 0
                        End If
                End Function

                Public Function getFileSizeTranslated(name)
                        If dict.Exists(name) Then
                                temp = 1 + LenB(dict(name).Item("Value"))
                                        If Len(temp) <= 3 Then
                                                getFileSizeTranslated = temp & " bytes"
                                        ElseIf Len(temp) > 6 Then
                                                temp = FormatNumber(((temp / 1024) / 1024), 2)
                                                getFileSizeTranslated = temp & " megabytes"     
                                        Else
                                                temp = FormatNumber((temp / 1024), 2)
                                                getFileSizeTranslated = temp & " kilobytes"
                                        End If
                        Else
                                getFileSizeTranslated = ""
                        End If
                End Function
                
                Public Function getContentType(name)
                        If dict.Exists(name) Then
                                getContentType = dict(name).Item("ContentType")
                        Else
                                getContentType = ""
                        End If
                End Function

        Private Sub getData(rawData)
                Dim separator 
                separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)

                Dim lenSeparator
                        lenSeparator = LenB(separator)

                Dim currentPos
                        currentPos = 1
                Dim inStrByte
                        inStrByte = 1
                Dim value, mValue
                Dim tempValue
                        tempValue = ""

                While inStrByte > 0
                        inStrByte = InStrB(currentPos, rawData, separator)
                        mValue = inStrByte - currentPos

                        If mValue > 1 Then
                                value = MidB(rawData, currentPos, mValue)

                                Dim begPos, endPos, midValue, nValue
                                Dim intDict
                                        Set intDict = Server.CreateObject("Scripting.Dictionary")
                
                                        begPos = 1 + InStrB(1, value, ChrB(34))
                                        endPos = InStrB(begPos + 1, value, ChrB(34))
                                        nValue = endPos

                                Dim nameN
                                        nameN = MidB(value, begPos, endPos - begPos)

                                Dim nameValue, isValid
                                        isValid = True
                                        
                                        If InStrB(1, value, stringToByte("Content-Type")) > 1 Then

                                                begPos = 1 + InStrB(endPos + 1, value, ChrB(34))
                                                endPos = InStrB(begPos + 1, value, ChrB(34))
        
                                                If endPos = 0 Then
                                                        endPos = begPos + 1
                                                        isValid = False
                                                End If
                                                
                                                midValue = MidB(value, begPos, endPos - begPos)
                                                        intDict.Add "FileName", trim(byteToString(midValue))
                                                                
                                                begPos = 14 + InStrB(endPos + 1, value, stringToByte("Content-Type:"))
                                                endPos = InStrB(begPos, value, ChrB(13))
                                                
                                                midValue = MidB(value, begPos, endPos - begPos)
                                                intDict.Add "ContentType", trim(byteToString(midValue))
                                                
                                                begPos = endPos + 4
                                                endPos = LenB(value)
                                                
                                                nameValue = MidB(value, begPos, endPos - begPos)
                                        Else
                                                nameValue = trim(byteToString(MidB(value, nValue + 5)))
                                        End If

                                        If isValid = true Then
                                                intDict.Add "Value", nameValue
                                                intDict.Add "Name", nameN

                                                dict.Add byteToString(nameN), intDict
                                        End If
                        End If

                        currentPos = lenSeparator + inStrByte
                Wend
        End Sub
        
        End Class

        Private Function stringToByte(toConv)
                Dim tempChar
                 For i = 1 to Len(toConv)
                        tempChar = Mid(toConv, i, 1)
                        stringToByte = stringToByte & chrB(AscB(tempChar))
                 Next
        End Function

        Private Function byteToString(toConv)
                For i = 1 to LenB(toConv)
                        byteToString = byteToString & chr(AscB(MidB(toConv,i,1))) 
                Next
        End Function
%>

بعدش هم يه برنامه اينطوري بنويسين و به اسم insert.asp ذخيره كننين:

کد:
<!-- #include file="Loader.asp" -->

<%
 Dim IW, IH
 
 Session.CodePage = 1252
 Session.LCID = 2057
 Response.CharSet = "Windows-1252"

 '// Large Images cause Portal Load problems, therefore I have restricted the Image Size
 Const MAXIMAGEWIDTH = 150
 Const MAXIMAGEHEIGHT = 150

          Dim ContentImagePath
ContentImagePath = "/ImageServer/"

    '// load object
    Dim load
    Set load = new Loader
                
     '// calling initialize method
     load.initialize
     
     '// File binary data
     Dim fileData
             fileData = load.getFileData("file")
     '// File name
     Dim fileName
             fileName = LCase(load.getFileName("file"))
     '// File path
     Dim filePath
             filePath = load.getFilePath("file")
     '// File path complete
     Dim filePathComplete
             filePathComplete = load.getFilePathComplete("file")
     '// File size
     Dim fileSize
             fileSize = load.getFileSize("file")
     '// File size translated
     Dim fileSizeTranslated
             fileSizeTranslated = load.getFileSizeTranslated("file")
     '// Content Type
     Dim contentType
             contentType = load.getContentType("file")

     '// No. of Form elements
     Dim countElements
             countElements = load.Count
     '// Value of text input field "name"
     Dim nameInput
             nameInput = load.getValue("name")
     '// Path where file will be uploaded
     Dim pathToFile
             fileName = Replace(fileName, " ", "_")
             pathToFile = ContentImagePath & "\" & fileName

     '// Uploading file data
     Dim fileUploaded
             fileUploaded = load.saveToFile ("file", pathToFile)

                
                 '// Destroying load object
     Set load = Nothing

Function bBuf(lngPos)
   bBuf = (AscB(MidB(fileData, lngPos, 1)))
End Function

Function Mult(lsb, msb)
    Mult = lsb + (msb * CLng(256))
End Function
%>

فقط من اينو از يه برنامه مفصل خودم وصله و پينه كردم. اگر مشكلي داشت خيلي كوچيك هستش كه حتما خودتون ميتونين رفعش كننين
آهان قسمت آخر برنامه كه بايد صداش كننين يا به برنامه خودتون اضافش كننين :

کد:
<% 
Response.Buffer = True 

Session.CodePage = 1252
Session.LCID = 2057
Response.CharSet = "Windows-1252"
%>

<html>
<head>
        <title>Insert Image</title>
        <style>
                body, input, td { font-family:verdana,arial; font-size:10pt; }
                .gInputButton { font-family:verdana,arial; font-size:10pt; width:80}
        </style>
</head>

<Script Language="JavaScript">

function DoOnLoad()
{
var iButtonHeight = tButtonSection.offsetHeight;

window.resizeTo(document.body.scrollWidth, document.body.scrollHeight + iButtonHeight + 30);
}
</Script>


<body OnLoad="DoOnLoad()">

<Script Language="JavaScript">
function DoClick()
{
if (document.form1.file.value != '')
        {
        opener.ImageAlt = document.form1.T2.value;
        opener.ImageAlign = document.form1.D1.options [document.form1.D1.selectedIndex].value;
        opener.ImageHSpace = document.form1.T3.value;
        opener.ImageVSpace = document.form1.T4.value;
        
        document.form1.action = 'insert.asp?UpLoad=True';
        document.form1.submit();
        }
}
</Script>

<form METHOD="POST" ENCTYPE="multipart/form-data" action="" name="form1" id="form1">
  <table border="1" width="100%" bordercolor="#000000" bordercolorlight="#000000" bordercolordark="#000000" cellspacing="0" cellpadding="15" name="table1" id="table1">
    <tr>
      <td width="100%">
  <table border="0" width="100%" cellpadding="0">
    <tr>
      <td width="100%" Class="gText"><%=GetInternationalString(conPictureSourceText)%>: <input type="file" accept="picture" name="file" size="20" Class="gInput"></td>
    </tr>
    <tr>
      <td width="100%" Class="gText"><%=GetInternationalString(conAlternateText)%>: <input type="text" name="T2" size="37" Class="gInput"></td>
    </tr>
    <tr>
      <td width="100%" Class="gText"><%=GetInternationalString(conAlignmentText)%>: <select size="1" name="D1" Class="gInput">
        <option value=""><%=GetInternationalString(conNotsetText)%></option>
        <option value="Left"><%=GetInternationalString(conLeftText)%></option>
        <option value="Right"><%=GetInternationalString(conRightText)%></option>
        <option value="Texttop"><%=GetInternationalString(conTexttopText)%></option>
        <option value="Absmiddle"><%=GetInternationalString(conAbsmiddleText)%></option>
        <option value="Baseline" selected><%=GetInternationalString(conBaselineText)%></option>
        <option value="Absbuttom"><%=GetInternationalString(conAbsbuttomText)%></option>
        <option value="Buttom"><%=GetInternationalString(conButtomText)%></option>
        <option value="Middle"><%=GetInternationalString(conMiddleText)%></option>
        <option value="Top"><%=GetInternationalString(conTopText)%></option>
         
        </select></td>
    </tr>
    <tr>
      <td width="100%" Class="gText"><%=GetInternationalString(conHorizontalText)%>:<input maxlength=3 type="text" name="T3" size="5" Class="gInput"></td>
    </tr>
    <tr>
      <td width="100%" Class="gText"><%=GetInternationalString(conVerticalText)%>:<input maxlength=3 type="text" name="T4" size="5" Class="gInput"></td>
    </tr>
  </table>
      </td>
    </tr>
  </table>
  <br>
  <table border="0" width="100%" cellpadding="0" cellspacing="0" name="tButtonSection" id="tButtonSection">
    <tr>
     <td  align="center">

  <input type="button" value="<%=GetInternationalString(conOkButton)%>" name="B1" size=20 class="gInputButton" OnClick="DoClick()">
      <input type="button" class="gInputButton" value="<%=GetInternationalString(conCancelButton)%>" name="B2" OnClick="window.close()">
     </td>
    </tr>
  </table>
</form>
<SCRIPT Language="JavaScript">
        document.form1.file.focus();
</SCRIPT>

</body>

</html>

ارادتمند
 

جدیدترین ارسال ها

بالا