Results 1 to 12 of 12

Thread: What's wrong with my code.

  1. #1

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    What's wrong with my code.

    What's wrong with my code ?

    i am uploading a file to image shack. i composted this code to my understanding by referring to http://www.vbforums.com/showpost.php...44&postcount=4


    Code:
    Private Sub Command1_Click()
        Dim intFile     As Integer  '// Next available number for the Open statement
        Dim ImageData   As String   '// Image contents
        Dim Body        As String   '// Body contents
        Dim Header      As String   '// Header contents
    
        '// Get the image contents
        imagepath = App.Path & "\" & "test.jpg" ' max 3mb image size limited
        intFile = FreeFile
        Open imagepath For Binary As #intFile
            ImageData = String(LOF(intFile), Chr(0))
            Get #intFile, , ImageData
        Close #intFile
    
        Body = "Content-Disposition: form-data; name=""fileupload""; filename=""" & vbCrLf
        Body = Body & "Content-Type: multipart/form-data" & vbCrLf
        Body = Body & vbCrLf & ImageData
    
    
        Header = "Host: imageshack.us" & vbCrLf
        Header = Header & "Content-Type: multipart/form-data  & vbCrLf"
        Header = Header & "Content-Length: " & Len(ImageData) & vbCrLf & vbCrLf
    
    
        'upload now
        Inet.Execute "http://www.imageshack.us", "POST", Body, Header
        
          While Inet.StillExecuting
            DoEvents
          Wend
          
          Dim s$, ret$
          
          s = Inet.GetChunk(1024)
          Do Until s = ""
            ret = ret & s
            s = Inet.GetChunk(1024)
          Loop
          
          'check upload completed
          If InStr(1, ret, "Show Advanced Linking") > 0 Then MsgBox "upload completed"
      End Sub
    Last edited by Fazi; Oct 18th, 2008 at 08:34 AM.

  2. #2
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: What's wrong with my code.

    Could try giving us an idea of why you think something is wrong with your code...it'd help us help you
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  3. #3

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: What's wrong with my code.

    hai smUx
    i dont undestand German language
    Code:
    Could try giving us an idea of why you think something ....
    btw, ill be back in 30 min

  4. #4
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: What's wrong with my code.

    http://translate.google.com/translate_t#

    It's not rocket science here, if you have a problem there's a solution somewhere which gets you closer to understanding the bigger problem :-P
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  5. #5

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: What's wrong with my code.

    smUX. ok ok kool.

    there's a solution somewhere
    yes, hope here i can find it

  6. #6
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: What's wrong with my code.

    Your Code:
    imagepath = App.Path & "\" & "test.jpg"

    My Code:
    imagepath = App.Path & "\test.jpg"
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  7. #7
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: What's wrong with my code.

    Quote Originally Posted by ThEiMp
    Your Code:
    imagepath = App.Path & "\" & "test.jpg"

    My Code:
    imagepath = App.Path & "\test.jpg"
    Those will both give the same result.

    But it would be a good idea to make sure that the "\" is needed.
    Sometimes App.Path provides it but most times it doesn't.

  8. #8

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: What's wrong with my code.

    theEmp,
    tx, but that is ok. no path problem in my code.
    the file is open for binary access with out error.

  9. #9
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: What's wrong with my code.

    Yes that is right, there is nothing more wrong with your code and I don't see why it won't run. Could you please post a working demo of your source code onto this thread, so that we can see if that is totally correct?
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  10. #10

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: What's wrong with my code.

    ofcause. give me a minute. ill attached it this this post it self.
    Attached Files Attached Files
    Last edited by Fazi; Oct 19th, 2008 at 01:26 AM.

  11. #11
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    Re: What's wrong with my code.

    Well I cannot get it to work, but with the source code that I could get to work. I added into it a message box, loading box. Which means that it will go on when it is loading, eg: visible = True and when it is not loading it will be visible = False.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  12. #12

    Thread Starter
    PowerPoster Fazi's Avatar
    Join Date
    Aug 2005
    Location
    Underworld
    Posts
    2,525

    Re: What's wrong with my code.

    ThEiMp,
    is upload success and returns the results page in your test?
    (which include the "Show Advanced Linking" keyword)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width